Skip to content

TCronModule daemon stop and retire requests retry the request lock within the timeout (#1497) - #1688

Merged
ctrlaltca merged 2 commits into
pradosoft:masterfrom
belisoful:claude/frosty-montalcini-b3df5c
Nov 29, 2026
Merged

ctrlaltca merged 2 commits into
pradosoft:masterfrom
belisoful:claude/frosty-montalcini-b3df5c

Conversation

@belisoful

Copy link
Copy Markdown
Member

Part of #1497.

TCronModule::requestDaemon(), behind requestDaemonStop() / requestDaemonRetire() and cron/stop / cron/retire, took the request lock once with a zero timeout. On each loop turn the daemon probes that lock: checkDaemonRequests() → isDaemonLockHeld() takes and releases it. A request that landed during the probe failed at once. It did not wake the daemon, and the daemon never saw it. cron/stop then reported "did not stop within the timeout" about 0.2 s after it started, and the daemon kept sweeping. This was seen once in CI, on PHP 8.5 in the features scenario of tests/cron-daemon/run.php.

  • requestDaemon() computes its deadline first. It acquires the request lock with the time that remains, so the mutex retries every RetryDelay. The acknowledgment wait gets whatever time is left after that.
  • A request that cannot take the lock before the deadline still returns false. That happens, for example, while another request holds the lock.
  • New test TCronModuleBaseTest::testRequestDaemonRetriesTheLockTheDaemonProbes:
    • It uses a mutex that refuses the first attempts and shows the request succeeds once the lock frees.
    • It shows a lock that stays busy fails after the full timeout.
    • The test fails without the fix.
  • The agents/ notes and HISTORY.md are updated.

Checks:

  • php -l, php-cs-fixer, and PHPStan are clean.
  • The full unit suite passes.
  • The changed tests pass on PHP 8.2–8.6.
  • php tests/cron-daemon/run.php all passes on macOS (PHP 8.2).

@ctrlaltca
ctrlaltca merged commit e27492b into pradosoft:master Nov 29, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants