php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67181 Event port code needs to reassociate to port after an event
Submitted: 2014-05-02 15:34 UTC Modified: 2021-12-07 22:14 UTC
From: d dot v dot taylor at leedsmet dot ac dot uk Assigned: bukka (profile)
Status: Closed Package: FPM related
PHP Version: 5.5.12 OS: Solaris 11.1
Private report: No CVE-ID: None
 [2014-05-02 15:34 UTC] d dot v dot taylor at leedsmet dot ac dot uk
Description:
------------
I've enabled request_slowlog_timeout on PHP-FPM, but it only seems to successfully act on the first request. Subsequent slow requests cause child processes to be sent the SIGSTOP but they *don't* then get traced and SIGCONT-ed, leaving them in a stopped state indefinitely.

I've investigated this and it looks like the problem is connected to the port event module. This is a section of the port_associate man page:

     When an event for a PORT_SOURCE_FD object is retrieved,  the
     object  no  longer  has  an  association with the port.  The
     event can be processed without the possibility that  another
     thread  can retrieve a subsequent event for the same object.
     After processing of the file descriptor  is  completed,  the
     port_associate()  function  can be called to reassociate the
     object with the port.

i.e. if any events are successfully read from the port in fpm_event_port_wait(), it needs an explicit call to port_associate() again to re-establish the association and ensure future events are listened for.

At the moment this doesn't happen, and so the parent FPM process doesn't see the subsequent port events caused by child processes being stopped.

The problem doesn't occur if I switch to using /dev/poll for the event mechanism.

Test script:
---------------
<?php
    /* Set e.g. request_slowlog_timeout = 5 */
    sleep(10);
    phpinfo();
?>


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-07-08 14:47 UTC] d dot v dot taylor at leedsmet dot ac dot uk
From a quick read, the patch attached to bug #65800 puts this re-association in.
 [2015-09-20 08:37 UTC] rainer dot jung at kippdata dot de
Please check the latest patch at

https://bugs.php.net/bug.php?id=65800

I expect your problem to be a dublicate.
 [2021-12-07 22:14 UTC] bukka@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bukka
 [2021-12-07 22:14 UTC] bukka@php.net
This has been fixed by https://github.com/php/php-src/pull/6913 so it's available in 7.4+
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 12:01:29 2024 UTC