Repository navigation
fix(process): stop waiting out the worker registration window (#479) - #494
Merged
Merged
Conversation
syslog_wait_workers() held the master in its registration stage until every launched worker was registered and running. Workers that had already finished, or exited because the processing lock check failed, were never counted, so each parallel phase waited the full ten seconds. A worker now counts once it is registered or has recorded statistics, read from the settings table rather than the read_config_option() cache, and the completion check uses the same fresh read. A worker that finds the processing lock no longer held by its master records a failed statistics row so the master stops waiting, and logs the expected owner and the holder IS_USED_LOCK() reported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Late reports from an earlier run can prematurely end the current registration wait because reports are not scoped by run ID and phase.
2 open issues
What changed in this PR
Reduces unnecessary delays in parallel Syslog processing and improves diagnostics for lock failures related to #479.
Changes:
- Counts running and completed workers without double-counting.
- Reads completion reports directly from settings and records lock-check failures.
- Adds regression tests and documents the fix.
| File | Description |
|---|---|
| tests/Unit/SyslogWorkerWaitTest.php | Tests completed-worker accounting and duplicate counting. |
| tests/Unit/ProcessingLockTest.php | Tests lock-holder reporting. |
| syslog_process.php | Records worker lock failures and diagnostic details. |
| includes/functions.php | Updates worker accounting and adds lock-holder lookup. |
| CHANGELOG.md | Documents the #479 timing and diagnostic improvements. |
Review effort: Balanced
Address review on #494. A child of an earlier run could report after the next run cleared the statistics rows and end its registration wait or be counted as its result. The wait, the completion check and the transfer aggregation now count only reports whose run_id and phase match, and a child that fails the lock check records its failure only while the lock is free, so it never overwrites a newer run's rows. The double-count regression test now asserts the exact poll count. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
xmacan
approved these changes
Dec 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.





Addresses the defect found while investigating #479.
Problem
syslog_wait_workers()held the master in its registration stage until every launched worker was registered and still running. Workers that had already finished, or that exited early because the processing-lock check failed, never counted. Every parallel phase therefore waited the full 10-second grace window:The completion check also used
read_config_option(), which caches per process. A value read during the references phase could be returned again during the transfer phase.Change
taskid) and fromstats_syslog_child_Nare merged rather than added, so a worker between writing its stats and unregistering isn't counted twice.settings(syslog_workers_reported()) for both the wait and the "exited without recording completion" warning.success: falsestats row (reason: lock) so the master stops waiting and the phase counts as failed. It also logs the expected owner and whatIS_USED_LOCK()returned, e.g.(expected connection 54, IS_USED_LOCK returned NULL), so the cause behind Latest Develop branch, new error message: One or more transfer workers failed #479 can be diagnosed from the log. That root cause is still pending reporter information.Verification
tests/Unit/SyslogWorkerWaitTest.php. The "already finished" case fails ondevelopafter the 10.02 s wait and passes with this change.develop, PHP 8.3,memory_limit=2G): 892 passed.developwith 2 workers and 500 messages: run time dropped from 11.2 s to 1.48 s, and all records transferred.--lock-ownerlogsIS_USED_LOCK returned NULL, writes the failed stats row, exits 1, and leaves no process row.php -lis clean. php-cs-fixer reports no new findings in the changed hunks, and PHPStan level 6 reports nothing on the new functions.