Skip to content

Improved prefork run-once mode#1532

Merged
DrDet merged 5 commits intomasterfrom
dvaksman/improve-run-once-prefork
Mar 2, 2026
Merged

Improved prefork run-once mode#1532
DrDet merged 5 commits intomasterfrom
dvaksman/improve-run-once-prefork

Conversation

@DrDet
Copy link
Contributor

@DrDet DrDet commented Feb 19, 2026

Main changes:

  • make pipe for dummy self queries nonblocking
  • send dummy self queries to pipe in bathces from event loop instead of straightforward loop at the beginning
  • next batch is sent only if we have nothing to do (no pending scripts)
  • extract the whole logic for invoking dummy self queries in separate class PhpScriptRunOnceInvoker
  • add e2e tests

Before these changes execution suspended infinitely with --once count more than 2720, caused by blocking writing to pipe when its buffer was overflowed.

- don't close write end of the pipe to prevent infinite hanging in the event loop
- send next batch of run once messages only if we don't have running php scripts
@DrDet DrDet added this to the next milestone Feb 19, 2026
@DrDet DrDet requested a review from PetrShumilov February 19, 2026 15:48
@DrDet DrDet self-assigned this Feb 19, 2026
@DrDet DrDet added the runtime Feature related to runtime label Feb 19, 2026
KPHP-CI
KPHP-CI previously approved these changes Feb 24, 2026
Copy link

@KPHP-CI KPHP-CI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic job!

Copy link

@KPHP-CI KPHP-CI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work!

Copy link
Contributor

@PetrShumilov PetrShumilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DrDet DrDet merged commit d10e913 into master Mar 2, 2026
7 checks passed
@DrDet DrDet deleted the dvaksman/improve-run-once-prefork branch March 2, 2026 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

runtime Feature related to runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants