Emit error event and close Stream when writing to stream resource fails#25
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi.
I have Ratchet working 24/7 and sometimes it starting to use 100% of CPU. In this case I need to restart it and this helps. But it happend very often, so I debug it and found that
foef($this->stream)do not returntruewhen client disconnects while event loop tick is not ended.Same with
is_resource($this->stream)it returnstrue.I'm using:
In this case after
$this->lastError['message']contains an error:There is no way to catch such behavior using best practices, so I decide to check
$this->lastError['message']on 'errno=10054'.Maybe it will be more efficient if we will check
$this->lastError['number']on any error> 0. But to prevent just on this case I decide to check only errno=10054 in message.I know this is not good resolution but it works.