8000 check return value of stream_select by mkrauser · Pull Request #20 · reactphp/event-loop · GitHub
[go: up one dir, main page]

Skip to content

check return value of stream_select #20

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

Closed
wants to merge 2 commits into from
Closed

check return value of stream_select #20

wants to merge 2 commits into from

Conversation

mkrauser
Copy link
Contributor

This change was already requested as part of reactphp/reactphp#297

In the current Implementation, the return value of stream_select is not checked at all. According to the php documentation, a return value of false indicates that the underlying system call failed, e.g. due to a received signal. If thats the case, we cannot savely rely on the outcome of stream_select.

Unlike reactphp/reactphp#297, this PR does not supress any raised warning.

@holycheater
Copy link

Example: some framework (like yii) converts all errors to exceptions.
In that case my app still dies

8000
@mkrauser
Copy link
Contributor Author
mkrauser commented Apr 6, 2015

@holycheater That's true, but not the target of this PR.

There has been a pull request to suppress these warnings (see reactphp/reactphp#297 ). Like @cboden said, error suppression would not be included in the core due to performance reasons. I solved this by using my custom EventLoop-Implementation.

@cboden
Copy link
Member
cboden commented Apr 8, 2015

Can you provide some example code so that I could see the error you see (before the PR change)?

@mkrauser
Copy link
Contributor Author

Sorry for the delay, I've created a repo with a small showcase-app here. If you run run-me.php and kill it afterwards, a warning is shown.

@clue
Copy link
Member
clue commented Sep 19, 2015

Changes LGTM, however I'm curious to see if we can come up with a reproducible test case 👍

FWIW: The Travis errors are unrelated (network hiccup).

@WyriHaximus
Copy link
Member

Changes LGTM but same as @clue I wonder IF we can come up with a test case 👍

@nrk
Copy link
Member
nrk commented Oct 1, 2015

$n stands for... ?

@mkrauser
Copy link
Contributor Author
mkrauser commented Oct 1, 2015

actually I don't recall why I named it $n. What name do you suggest?

@nrk
Copy link
Member
nrk commented Oct 1, 2015

@mkrauser considering that stream_select() returns the number of streams available for reading / writing, $available could be a decent candidate.

@mkrauser
Copy link
Contributor Author
mkrauser commented Oct 1, 2015

@nrk Ok, personally I'm using $n for numbers, but $available is indeed more readable. I've changed it

cebe added a commit to cebe/event-loop that referenced this pull request Feb 27, 2016
@cboden
Copy link
Member
cboden commented Mar 4, 2016

Closing in favour of #44 being merged

@cboden cboden closed this Mar 4, 2016
@WyriHaximus WyriHaximus mentioned this pull request Jul 25, 2017
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0