Bug #49340 [Com]: Signals not catchable when certain functions are in execution

From: Date: Tue, 12 Jun 2018 12:20:30 +0000
Subject: Bug #49340 [Com]: Signals not catchable when certain functions are in execution
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215649@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=49340&edit=1

 ID:                 49340
 Comment by:         dnt at gmx dot gom
 Reported by:        alexmontoanelli at gmail dot com
 Summary:            Signals not catchable when certain functions are in
                     execution
 Status:             Open
 Type:               Bug
 Package:            PCNTL related
 Operating System:   Linux
 PHP Version:        5.2.10
 Block user comment: N
 Private report:     N

 New Comment:

I also stumbled upon this, I as well think this is not the expected behavior. There exists a third
party extension that should work with blocking PHP scripts. I haven't tested it, though. 
https://github.com/rstgroup/php-signal-handler


Previous Comments:
------------------------------------------------------------------------
[2017-01-01 21:53:42] dave at mudsite dot com

Another oddity with this is that using pcntl_async_signals() rather than declare(ticks=1) results
with no handling of your ^C's

------------------------------------------------------------------------
[2016-07-13 00:24:44] anthonyryan1 at gmail dot com

Just encountered this in PHP 7.0.6. The fgets blocking operation still prevents signal handlers from
firing.

------------------------------------------------------------------------
[2012-01-31 13:53:00] nasretdinov at gmail dot com

Actually it is due to syscall restarting by default. You should pass third 
argument as "false" to pcntl_signal and you will be able to catch SIGINT, but 
only after second attempt. The other bug I created (https://bugs.php.net/bug.php?
id=52121) addresses more severe case, I suppose

------------------------------------------------------------------------
[2009-08-31 13:42:12] alexmontoanelli at gmail dot com

Ok.But I guess that this behavior is not that anyone expect.

Some one else can give the final word ?

Regards

------------------------------------------------------------------------
[2009-08-27 19:30:38] sjoerd@php.net

PHP signals are implemented with ticks
(http://us3.php.net/manual/en/control-structures.declare.php). Ticks are events that occur every so
much statements in a script. Since fgets() blocks, no more statements are executed and no more ticks
are fired. This means that no signal arrives.

I do not know whether the current behavior is by design or by mistake, so I cannot determine whether
it is a bug or not. It would certainly be desirable to be able to interrupt a blocking read by doing
Ctrl-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=49340


--
Edit this bug report at https://bugs.php.net/bug.php?id=49340&edit=1


Thread (11 messages)

« previous php.bugs (#215649) next »