Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix pcntl_rfork() / pcntl_forkx() with zend-max-execution-timers #18958

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
wants to merge 1 commit into from

Conversation

arnaud-lb
Copy link
Member

@arnaud-lb arnaud-lb commented Jun 27, 2025

After calling pcntl_rfork() or pcntl_forkx(), the child process triggers a fatal error during shutdown, in ZTS builds with --enable-zend-max-execution-timers:

Fatal error: Could not set timer: Invalid argument (22) in Unknown on line 0

Here I fix this issue by calling zend_max_execution_timer_init(); in the child process, as we do in pcntl_fork():

php-src/ext/pcntl/pcntl.c

Lines 299 to 300 in c7c6a79

} else if (id == 0) {
zend_max_execution_timer_init();

/* Must be called after calls to fork() */
ZEND_API void zend_max_execution_timer_init(void);

See also: #10141

@arnaud-lb arnaud-lb changed the base branch from master to PHP-8.3 June 27, 2025 12:08
@arnaud-lb arnaud-lb marked this pull request as ready for review June 27, 2025 12:43
@arnaud-lb arnaud-lb requested a review from devnexen as a code owner June 27, 2025 12:43
Copy link
Member

@devnexen devnexen left a comment

Choose a reason for hiding this comment

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

LCTM

@arnaud-lb
Copy link
Member Author

Closed by aee1d7f

@arnaud-lb arnaud-lb closed this Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants