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
Avoid warning when catching signal with pcntl_signal() #297
Conversation
Symfony's implementation is quite similar but more precise I think. See implementation at https://github.com/symfony/symfony/blob/27e1a893a090bf58bce774660f6cb5cbdfd4d287/src/Symfony/Component/Process/ProcessPipes.php#L359-L365 and usage at https://github.com/symfony/symfony/blob/27e1a893a090bf58bce774660f6cb5cbdfd4d287/src/Symfony/Component/Process/ProcessPipes.php#L235-L241 |
Great idea, but they use the prefix |
I'm curious about what low performance you're speaking. Symfony's code bypasses the error and check if it was a interrupted system call only if |
I was not saying my fix is more efficient than another. I just tried to avoid the |
no worries. Avoid the use of |
Fixes are available as @romainneutron advised. I saw a bug only after some commit sorry. |
Works like a charm. When does it get merged back? |
$lastError = error_get_last(); | ||
|
||
// stream_select returns false when the `select` system call is interrupted by an incoming signal | ||
return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some tests would be much appreciated 👍
Also IIRC, the error messages take the user's LOCALE
into account and might be translated to another language. If so, how should we match those?
@clue I've my locale set to french and the message is still in english. |
When is it planned to get merged? |
Why not merged yet? |
This is now a read-only repo made up of components loaded from composer. Merge requests need to made against the event-loop. In addition, I wouldn't want to include |
Right, supressing errors is bad for performance, especially inside the event-loop. I wouldn't put this into the core either. But there should be a way out for users. Maybe a special subclass or at least a hint in the docs. Regarding the check for the return-value: this should definitely be merged. If the stream_select-call fails, you should not rely on the references. |
Try use |
I am pretty sure this will slow down your app considerably. On Wed, Jun 10, 2015 at 7:51 AM, Kamil Harasimowicz <
|
Probably yes but in many cases it might not be as critical, and will work without problems. |
This PR seems like a good starting point, thanks @Divi! This PR has been WIP for quite some time now and things have changed considerably since then :-) React now consists of individual components that are maintained individually. Supporting signal handling is now related to the react/event-loop component. Somebody has already filed a ticket reactphp/event-loop#8 to keep track of this, so I suppose it makes sense to focus our signal handling related efforts on this component. |
Creating a temporary error handler when selecting/accepting a stream to avoid warning messages, caused by catching a signal with function
pcntl_signal()
.See issue : #296