decremented exit guard when failed to write header #37

merged 2 commits into from Oct 12, 2013


None yet
2 participants

maedama commented Sep 28, 2013

I think Twiggy fails to decrement exit_guard counter when, it fails to write response header (i.e EPIPE).
I have not written a test yet but this pull request should fix the problem. Please tell me if I am wrong in any ways.


miyagawa commented Oct 11, 2013

Can you write a test, or at least how to reproduce the problem? Thanks!


maedama commented Oct 12, 2013

Thanks for the response! I would write test and come back.


maedama commented Oct 12, 2013

Hi @miyagawa san I have added a test.

Let me explain problems I am facing in detail. I have implemented Chat Online Server with Twiggy::Prefork and Server::Starter.

In our production environment, we see IO Error when writing header on rare occasion.

What happens then, is that Twiggy's exit_guard fails to decrement as I have written previously. And When we try to restart a process by HUP signal or process reaches max-request-per-client, the process stops to accept new connection and wait until all request are served, but this condition is never met due to exit_guard decrement failure and process hangs forever.

miyagawa added a commit that referenced this pull request Oct 12, 2013

Merge pull request #37 from maedama/hotfix/exit_guard_count_miss
decremented exit guard when failed to write header

@miyagawa miyagawa merged commit 761545e into miyagawa:master Oct 12, 2013


maedama commented Oct 17, 2013

Thanks as lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment