Skip to content
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

ExtEventLoop: No longer suppress all errors #65

Merged
merged 1 commit into from Feb 15, 2017
Merged

ExtEventLoop: No longer suppress all errors #65

merged 1 commit into from Feb 15, 2017

Conversation

@mamciek
Copy link

@mamciek mamciek commented Jan 9, 2017

No description provided.

@@ -178,8 +178,7 @@ public function tick()

$this->futureTickQueue->tick();

// @-suppression: https://github.com/reactphp/react/pull/234#discussion-diff-7759616R226
@$this->eventBase->loop(EventBase::LOOP_ONCE | EventBase::LOOP_NONBLOCK);
$this->eventBase->loop(EventBase::LOOP_ONCE | EventBase::LOOP_NONBLOCK);
Copy link
Member

@clue clue Jan 9, 2017

How can we verify the above comment is no longer relevant?

Can you add some tests to verify this?

Copy link
Author

@mamciek mamciek Jan 9, 2017

I do not know if the above comment is relevant or not. I do know that this @-suppression supress ALL php errors that is ever generated by PHP (inside event handler) which is very bad

Copy link
Member

@clue clue Jan 9, 2017

I understand, but if fix this now we should make sure to avoid any regressions in the future.

Can you add some tests to verify this?

Copy link
Member

@jsor jsor Feb 3, 2017

I've did some tests today but i can't reproduce this. The comment in reactphp/reactphp#234 (diff) is also not clear in what exactly produces these warnings. Maybe @nrk or @jmalloc can shed some light on this.

I agree that the @ is really bad here because it also supresses any warnings and errors from the callbacks.

Copy link
Contributor

@jmalloc jmalloc Feb 6, 2017

IIRC, the initial problem was that EventBase::loop() emits an (additional?) warning after an error in a user-defined callback. So, perhaps calling trigger_error() in a timer function, or something like that would reproduce it. I can't recall if I witnessed this myself, but I kept the @-suppression at @nrk's request.

I can see where this warning might be an issue, especially when using a strict error handler, but it's arguably the responsibility of the user to handle/suppress any such errors in callbacks. So as long as we're not producing them in the loop implementation ourselves it's probably OK to remove the @.

Copy link
Member

@clue clue Feb 7, 2017

In the meanwhile I can open an issue on pecl-event to let the author know about this.

Yes, pushing this upstream is where this should be addressed in the first place! 👍

I'd say it's better to have additional warnings than suppressing everything.
[…]
3. Remove the @-suppression and document the change and it's impact in the changelog

Absolutely agree here! 👍

Given this only triggers when an uncaught warning or exception is passed through, I expect this to have very little impact in actual consumer code. After all, this is something that should never happen in the first place. Also, this only triggers an additional warning, so I agree this should be safe to add regardless 👍

This means that even if upstream takes longer to fix this and this be inconsistent across different upstream versions, I think it makes perfect sense to get this in now already 👍

Copy link
Member

@nrk nrk Feb 7, 2017

Given this only triggers when an uncaught warning or exception is passed through, I expect this to have very little impact in actual consumer code.

@clue the additional warning is emitted even when the exception is caught, see the example in my previous comment.

Copy link
Member

@jsor jsor Feb 8, 2017

@jsor alright will do tomorrow first thing in the morning!

@nrk Are you still planning to file an issue in the pecl-event repo? Otherwise i can do it.

@clue the additional warning is emitted even when the exception is caught, see the example in my previous comment.

Yes, but only if the exception bubbles up to the $this->eventBase->loop() call. This usually results in an uncaught exception anyway since in almost all cases $loop->run() is called at the end of the script.

Copy link
Member

@nrk nrk Feb 8, 2017

@jsor sure that's still my plan, actually I was modifying the extension myself to test this change and eventually have a PR ready if the author agrees, just ended up having unexpected stuff going on at work so couldn't do it yet. As for uncaught exceptions: yes and I realized later that I misinterpreted what @clue meant with passed through.

Copy link
Member

@jsor jsor Feb 8, 2017

sure that's still my plan, actually I was modifying the extension myself to test this change and eventually have a PR ready if the author agrees, just ended up having unexpected stuff going on at work so couldn't do it yet.

No hurries, very appreciated 👍

@mamciek
Copy link
Author

@mamciek mamciek commented Feb 7, 2017

The problem is half solved now :) One of the @ suppression was removed with 8fa0407

jsor
jsor approved these changes Feb 8, 2017
Copy link
Member

@jsor jsor left a comment

👍 for getting this in, i'll do a followup PR with a changelog entry

@clue clue changed the title Remove @-suppression from event loop ExtEventLoop: No longer suppress all errors Feb 8, 2017
clue
clue approved these changes Feb 8, 2017
Copy link
Member

@clue clue left a comment

Also 👍 from my end.

See also above for some very good discussion about testing this: #65 (comment)
Short version, we can not reliably test the @ is needed in the first place, but we have a good understanding of the problem at hand, so we can omit a test here IMHO.

@clue clue added this to the v0.4.3 milestone Feb 8, 2017
@clue
Copy link
Member

@clue clue commented Feb 8, 2017

@mamciek May I ask you to rebase this on the new "0.4" branch so we get this in for the upcoming v0.4.3 release? :shipit:

@mamciek mamciek changed the base branch from master to 0.4 Feb 15, 2017
@mamciek
Copy link
Author

@mamciek mamciek commented Feb 15, 2017

Sure. Done.

@jsor jsor merged commit f5a8549 into reactphp:0.4 Feb 15, 2017
1 check passed
@jsor
Copy link
Member

@jsor jsor commented Feb 15, 2017

Thanks! 👍

@jsor jsor mentioned this pull request Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants