Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

fixed racing condition of the simple worker #2266

Merged
merged 1 commit into from
May 14, 2022

Conversation

sio4
Copy link
Member

@sio4 sio4 commented May 14, 2022

The new standard (reusable) testing workflow detected racing conditions on the buffalo core, and they were all in the Simple Worker. The root cause was basically:

  • There are many goroutines that use a context, and the context reading/writing caused data race.
  • Functions such as PerformIn() can be called while configuring the App and they use the default context.
  • Worker is started by Start(context) with a new context when App.Serve() is called after the App setup was finished.

Additionally, the Worker spec is not clear enough for each function's purpose and expected actions. We need to revisit this when we design the next version. (#2242)

  • The name of Perform*() is not clear. Their actual action should be enqueuing (not to perform the job by itself) even though the Simple Worker does perform the job.
  • Need to define when the job submission (calling Perform*()) is allowed.
  • ...

Anyway, this PR will fix the issue for now and will make the new testing works fine. (#2265)

@sio4 sio4 added the bug Something isn't working label May 14, 2022
@sio4 sio4 requested review from paganotoni and a team May 14, 2022 05:22
@sio4 sio4 self-assigned this May 14, 2022
@sio4 sio4 enabled auto-merge (rebase) May 14, 2022 05:28
@sio4 sio4 merged commit deaf8bb into development May 14, 2022
@paganotoni paganotoni deleted the fix-racing-condition-of-simple-worker branch May 14, 2022 14:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants