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

Issue #36 - Twiggy died when client close connection during streaming #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ISim
Copy link

@ISim ISim commented Apr 16, 2015

This PR solves issue #36 (a little bit better than PR 39 - #39)

With AnyEvent::Loop (pure perl) Twiggy dies when client close connection during streaming:
AnyEvent::Handle uncaught error: Broken pipe (SIGPIPE)

With EV loop implementation, Twiggy produces warning
EV: error in callback (ignoring): AnyEvent::Handle uncaught error: Broken pipe (SIGPIPE)

This PR:

  • installs on_error handler during Twiggy::Writer construction
  • the method $writer->write() doesn't call push_write when error occurred and on_error was called
  • added test t/anyevent_closed_streaming_async.t

However, the problem with streaming is not completely solved. PSGI specs doesn't specify any interface of the writer object to stop streaming in case of error - see details plack/psgi-specs#27
It can lead to infinite streaming in the worst case.

* installing on_error handler
* ignoring $writer->write() when handler is closed
* added test  t/anyevent_closed_streaming_async.t
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.

1 participant