rfc:additional-context-in-pcntl-signal-handler

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
rfc:additional-context-in-pcntl-signal-handler [2016/06/20 17:06] bishoprfc:additional-context-in-pcntl-signal-handler [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== PHP RFC: Additional Context in pcntl_signal Handler ====== ====== PHP RFC: Additional Context in pcntl_signal Handler ======
-  * Version: 0.2+  * Version: 1.0
   * Date: 2016-06-14   * Date: 2016-06-14
   * Authors: David Walker <dave@mudsite.com>, Bishop Bettini <bishop@php.net>   * Authors: David Walker <dave@mudsite.com>, Bishop Bettini <bishop@php.net>
-  * Status: Draft+  * Status: Accepted
   * First Published at: http://wiki.php.net/rfc/additional-context-in-pcntl-signal-handler   * First Published at: http://wiki.php.net/rfc/additional-context-in-pcntl-signal-handler
  
Line 21: Line 21:
     printf('USR1 from %s', $siginfo['pid'] ?? 'unknown');     printf('USR1 from %s', $siginfo['pid'] ?? 'unknown');
 }); });
-posix_kill(0, SIGUSR1);+posix_kill(posix_getpid(), SIGUSR1); 
 +pcntl_signal_dispatch();
 </file> </file>
  
Line 51: Line 52:
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
  
-Next PHP 7.x.+Next PHP 7.x, currently 7.1.
  
  
Line 69: Line 70:
 None. None.
  
 +===== Discussion =====
 +
 +Instead of updating ''pcntl_signal'', it was suggested to add a method ''pcntl_sigaction'', which would "keep maximum compatibility and eliminate unnecessary additional overhead". This suggestion was later withdrawn as perhaps adding more complication than the patch itself, though a later [[https://github.com/php/php-src/pull/1985|PR]] addressed parts of the suggestion. [[https://www.mail-archive.com/internals@lists.php.net/msg86504.html|Reference.]]
 +
 +Performance was raised as a concern. Having run tests through callgrind there is an additional 0.0001% cost for the feature. The profiled code defined an empty function, set the handler, and triggered the signal. Passing the additional information resulted in 2000 extra instructions, out of a total 13 million. This seems negligible compared to the cost of acquiring the same information through other means (eg message queues, temporary files, etc.).
  
 ===== Open Issues ===== ===== Open Issues =====
Line 80: Line 86:
 Requires a 50%+1 majority. Requires a 50%+1 majority.
  
 +<doodle title="Provide additional context in pcntl signal handler?" auth="bishopb" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
 +
 +Voting shall close one week after opening on Thursday, July 14, 2016 at 23:59 UTC.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
  
-  * [[https://github.com/bp1222/php-src|Work in Progress]]+  * [[https://github.com/php/php-src/pull/1993|Implementation with tests.]]
  
  
Line 89: Line 101:
  
   * [[https://marc.info/?l=php-internals&m=146584196929126&w=2|Initial ping to php.internals]]   * [[https://marc.info/?l=php-internals&m=146584196929126&w=2|Initial ping to php.internals]]
 +  * [[https://marc.info/?l=php-internals&m=146670242109688&w=2|Discussion]]
rfc/additional-context-in-pcntl-signal-handler.1466442400.txt.gz · Last modified: 2017/09/22 13:28 (external edit)