Bug #65800 [Asn->Csd]: FPM won't listen to signals when event ports and catch_workers_output are used
Edit report at https://bugs.php.net/bug.php?id=65800&edit=1
ID: 65800
Updated by: git@php.net
Reported by: filip at hajny dot net
Summary: FPM won't listen to signals when event ports and
catch_workers_output are used
-Status: Assigned
+Status: Closed
Type: Bug
Package: FPM related
Operating System: SmartOS (possibly SunOS)
PHP Version: Irrelevant
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of krakjoe
Revision: https://github.com/php/php-src/commit/2558acbd660c73b63ce541f66a35faac24ee83bb
Log: Fixed bug #65800 php-fpm: fix Solaris port events.mechanism
Previous Comments:
------------------------------------------------------------------------
[2021-05-03 12:58:39] bukka@php.net
The following pull request has been associated:
Patch Name: php-fpm: fix Solaris port events.mechanism
On GitHub: https://github.com/php/php-src/pull/6913
Patch: https://github.com/php/php-src/pull/6913.patch
------------------------------------------------------------------------
[2016-05-04 03:54:42] laruence@php.net
I don't understand why fpm_event_add is added here.
anyway, could you please make a PR at github https://github.com/php/php-src?
we may need more eyes on this.
thanks
------------------------------------------------------------------------
[2015-09-20 08:33:18] rainer dot jung at kippdata dot de
We observed the problem on Solaris too.
I added another patch that contains the following three parts:
- switch variables "nget" and "i" to unsigned. The Solaris event ports API uses
unsigned nget and this change silences compiler warnings. This part is unrelated to the rest and the
leats important.
- Check events returned when EINTR was caught. We observed crashed during testing for PHP 7 when
starting fpm and then stopping without any requests being handled. The crashes were due to event
ports returning nget=1 if EINTR occurred, but in fact nget simply wasn't changed from what had
been put into the port_getn call. The crash then happened, because portev_user didn't point to
the address of the event callback function but instead to some other (invalid) memory address. To
check whether actually an event is available, the patch sets portev_user to a magic value and checks
it after port_getn returns. This fixes the crash. The fix is taken from the Apache APR library,
which in turn took it likely form libev. See also the old Solaris discussion at http://marc.info/?l=opensolaris-networking-discuss&m=125071205204540.
This problem e.g. also hit Apache 2.4 on Solaris when it was new.
- I mostly copoied the third part from the previous patch here, namely re-associating the evevtn
with the port after port_getn. Without this e.g. Stopping directly after starting doesn't work.
The children send their SIGCHLD, the signal is received and the "C" character is send to
the pipe, but the receiving event never happens, so the children remain as zombies and the master
process never stopps. I only changed the previous patch from doing the port_associate as a copy of
the code in fpm_event_port_add() to directlxy call fpm_event_port_add(). Note that any error form
fpm_event_port_add() is not being handled, but it isn't handled in other places calling
fpm_event_port_add(), so at least it is consistent. Even without handling errors from
fpm_event_port_add() the code is more correct than without calling it at all.
The patch applies to PHP 5.4, 5.5, 5.6 and 7.0. The problems have only been observed by us for 7.0
but that was likely just luck.
Other open PHP bugs that likely will also be fixed by this path:
- https://bugs.php.net/bug.php?id=66694
- https://bugs.php.net/bug.php?id=67181
- https://bugs.php.net/bug.php?id=68349
I'll add a reference to the new patch there, mybe we can get some more testing from those other
users.
------------------------------------------------------------------------
[2014-07-08 14:47:04] d dot v dot taylor at leedsmet dot ac dot uk
Related To: Bug #67181
------------------------------------------------------------------------
[2014-06-13 13:02:31] filip at hajny dot net
We have been providing patched 5.3/5.4/5.5 packages for 6 months by now to the Joyent Public Cloud
customers, and it's what it takes to fix the problem. See the attached patch
(patch-sapi_fpm_fpm_events_port.c).
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=65800
--
Edit this bug report at https://bugs.php.net/bug.php?id=65800&edit=1
Thread (6 messages)