Skip to content

Endless loop when writing to disconnected socket #11

Closed
@andreme

Description

@andreme

In Buffer->handleWrite() the result of fwrite is compared to false to check for errors.
In my case it returns 0 (and fills lastError with fwrite(): send of 49 bytes failed with errno=10054 An existing connection was forcibly closed by the remote host.).

The check for (0 === $sent && feof($this->stream)) fails as well because feof($this->stream) returns false.
Removing && feof($this->stream) fixes the problem.

I use the socket server and socket client. When I kill the server process and the client tries to write something, it loops forever with 100% cpu.

For further reference: http://php.net/manual/en/function.fwrite.php#96951

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions