-
Notifications
You must be signed in to change notification settings - Fork 11.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CLOSED:INTENDED BEHAVIOR] Scheduler: Race condition in releasing mutex for overlapping/identical events. #53342
Comments
|
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
This comment has been minimized.
This comment has been minimized.
@crynobone how does this get fixed by #53640 ? #53640 was closed as a duplicate of this issue |
Sorry about this @rodrigopedra but it does seem there no progress on this. But a PR to fix the issue is always welcome. |
Love that this was black holed and closed as a duplicate of itself. PEBKAC |
@yoosefi feel free to submit a PR. |
@crynobone a PR for what? the issue was closed remember 🤡 |
Doesn't matter as this has been marked as Help Wanted but staled.
|
So reopen? |
A stale (no PR) issue will be closed regardless. |
@crynobone the race condition doesn't magically disappear if you ignore it. this isn't a feature request, buddy. how did you even get on the team? |
"this is fine" |
Laravel Version
11.26.0
PHP Version
8.2.24 (irrelevant)
Database Driver & Version
SQLite 3.37.2 (irrelevant)
Description
When scheduling events in
App\Console\Kernel::schedule()
, and having an event not overlap itself forM
minutes, if the event takes too long and is overlapped but completes first, it releases the mutex that is owned by the newer event, allowing the newer event to be overlapped immediately regardless ofM
.Steps To Reproduce
M
minutes; it holds a mutex forM
minutes.M
minutes to complete, mutex expires.CacheEventMutex::forget()
force-releases Event-Y's mutex, which may still be running (this is not fine).M
Solution:
CacheEventMutex::create()
must provide an$owner
to the lock, or retrieve the owner after creation. This prevents a random identifier from being used during lock creation and then immediately lost. Where this value lives can be discussed. It only needs to exist in the current runtime.CacheEventMutex::forget()
must not force-release if an owner is already known fromcreate()
. This allowsScheduleClearCacheCommand
to still force-release by not giving one.ScheduleFinishCommand
should accept an owner identifier to ensure that the owners are the same when attempting mutex release for background jobs. The owner, as determined in the same runtime, should be given byCommandBuilder::buildBackgroundCommand()
.The text was updated successfully, but these errors were encountered: