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

fwrite(): send of 4 bytes failed with errno=32 Broken pipe #477

Closed
webocoders opened this issue Dec 27, 2016 · 3 comments
Closed

fwrite(): send of 4 bytes failed with errno=32 Broken pipe #477

webocoders opened this issue Dec 27, 2016 · 3 comments

Comments

@webocoders
Copy link

webocoders commented Dec 27, 2016

Sometimes I have an error in vendor/react/stream/src/Buffer.php (line:86)
fwrite(): send of 4 bytes failed with errno=32 Broken pipe

in this line:
$sent = fwrite($this->stream, $this->data);

What should I do? Thanks.

Info:

PHP version 5.6.26.

composer show -i:

cboden/ratchet v0.3.5 PHP WebSocket library
evenement/evenement v2.0.0 ├Йv├йnement is a very simple event dispatching library for PHP
guzzle/common v3.9.2 Common libraries used by Guzzle
guzzle/http v3.9.2 HTTP libraries used by Guzzle
guzzle/parser v3.9.2 Interchangeable parsers used by Guzzle
guzzle/stream v3.9.2 Guzzle stream wrapper component
monolog/monolog 1.21.0 Sends your logs to files, sockets, inboxes, databases and various web services
psr/log 1.0.2 Common interface for logging libraries
react/event-loop v0.4.2 Event loop abstraction layer that libraries can use for evented I/O.
react/socket v0.4.3 Library for building an evented socket server.
react/stream v0.4.4 Basic readable and writable stream interfaces that support piping.
react/zmq v0.3.0 ZeroMQ bindings for React.
symfony/event-dispatcher v3.1.6 Symfony EventDispatcher Component
symfony/http-foundation v3.1.6 Symfony HttpFoundation Component
symfony/polyfill-mbstring v1.2.0 Symfony polyfill for the Mbstring extension
symfony/routing v3.1.6 Symfony Routing Component

@cboden
Copy link
Member

cboden commented Dec 30, 2016

Can you provide more of the stack trace? The is an error that shows up in your logs but everything continues to work, correct?

The error message is when a peer attempts to send data over a closed connection. Odds are this is just the result of a race condition that can be ignored. (The client closed the connection just as the server was sending it data).

@webocoders
Copy link
Author

webocoders commented Jan 2, 2017

Stack trace:

#0 [internal function]: React\Stream\Buffer->handleWrite(Resource id #171646, Object(React\EventLoop\StreamSelectLoop))
#1 /var/www/myproject.com/protected/ratchet/vendor/react/event-loop/src/StreamSelectLoop.php(240): call_user_func(Array, Resource id #171646, Object(React\EventLoop\StreamSelectLoop))
#2 /var/www/myproject.com/protected/ratchet/vendor/react/event-loop/src/StreamSelectLoop.php(201): React\EventLoop\StreamSelectLoop->waitForStreamActivity(NULL)
#3 /var/www/myproject.com/protected/ratchet/bin/push-server.php(33): React\EventLoop\StreamSelectLoop->run()
#4 {main}

The is an error that shows up in your logs but everything continues to work, correct?

Yes, if an error occurs, the work does not stop.

@cboden
Copy link
Member

cboden commented Jan 2, 2017

Try updating your dependencies. There was some logic change in the last update reactphp/stream with writing to stream buffers. (reactphp/stream@v0.4.4...v0.4.5).

Also take a look at this unit test which is testing the exact error you received. The test is writing to a closed stream and expecting the error you received back. This is what leads me to believe this is an error you can ignore.

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

No branches or pull requests

2 participants