Skip to content

Avoid warning when catching signal with pcntl_signal() - #297

Closed
Divi wants to merge 8 commits into
reactphp:masterfrom
Divi:master
Closed

Avoid warning when catching signal with pcntl_signal()#297
Divi wants to merge 8 commits into
reactphp:masterfrom
Divi:master

Conversation

@Divi

@Divi Divi commented Apr 19, 2014

Copy link
Copy Markdown

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

@romainneutron

Copy link
Copy Markdown
Member

@Divi

Divi commented Apr 19, 2014

Copy link
Copy Markdown
Author

Great idea, but they use the prefix @, and I wanted to avoid it due to low performance of this trick.

@romainneutron

Copy link
Copy Markdown
Member

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 stream_select returned false whereas your implementation switches the error handler twice for every call. It's definitely not a such low performance trick :)

@Divi

Divi commented Apr 19, 2014

Copy link
Copy Markdown
Author

I was not saying my fix is more efficient than another. I just tried to avoid the @ trigger.
Moreover, I didn't know about the false return statement on error of the function stream_select, so the Symfony's fix is clearly better.
I can't fix it this PR today. I'll do the change tomorrow :)

@romainneutron

Copy link
Copy Markdown
Member

no worries. Avoid the use of @ when it's about dicarding errors when they should not be, but in this case we just filter errors that could be safely discarded.
thanks for your work

@Divi

Divi commented Apr 21, 2014

Copy link
Copy Markdown
Author

Fixes are available as @romainneutron advised. I saw a bug only after some commit sorry.

@mathielen

Copy link
Copy Markdown

Works like a charm. When does it get merged back?

Copy link
Copy Markdown
Member

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?

@Divi

Divi commented May 6, 2014

Copy link
Copy Markdown
Author

@clue I've my locale set to french and the message is still in english.

@kingcrunch

Copy link
Copy Markdown

When is it planned to get merged?

@POPSuL

POPSuL commented Nov 14, 2014

Copy link
Copy Markdown

Why not merged yet?

@cboden

cboden commented Nov 16, 2014

Copy link
Copy Markdown
Member

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 @stream_select in the source code. stream_select is the core of the EventLoop and error suppression is detrimental to performance.

@mkrauser

mkrauser commented Dec 3, 2014

Copy link
Copy Markdown

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.

@HarasimowiczKamil

Copy link
Copy Markdown

Try use declare(ticks=1); on top in root file. Then you can catch signals without errors/warnings.

@frodeborli

Copy link
Copy Markdown

I am pretty sure this will slow down your app considerably.

On Wed, Jun 10, 2015 at 7:51 AM, Kamil Harasimowicz <
[email protected]> wrote:

Try use declare(ticks=1); on top in root file. Then you can catch signals
without errors/warnings.


Reply to this email directly or view it on GitHub
#297 (comment).

@HarasimowiczKamil

Copy link
Copy Markdown

Probably yes but in many cases it might not be as critical, and will work without problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants