decremented exit guard when failed to write header #37

Merged
merged 2 commits into from Oct 12, 2013

2 participants

@maedama

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
Owner

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

@maedama

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

@maedama

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 miyagawa merged commit 761545e into miyagawa:master Oct 12, 2013
@maedama

Thanks as lot!

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