I've been trying to understand what happens in Unicorn when a client
terminates a connection, and nginx logs a 499 response code.

In my debugging this can happen if the client is on a flaky connection,
or if they double-click a form submit button, the first request is
terminated and nginx logs a 499 response code.

It seems that in this case the Rails app actually aborts the request,
wherever it is in the course of it. The issue I ran into is that my app
made a destructive request to an external service in 
the context of a request, but the client disconnected before the app was
able to respond. So the external service returned its response but the
request was aborted before the app was able 
to commit its transaction to the database, confusion ensued.

Can you confirm that this is actually what happens in Unicorn when the
client disconnects? I'm not seeing anything in the logs to indicate the
actual behaviour.

In dealing with this I'm thinking about turning on
proxy_ignore_client_abort
(http://wiki.nginx.org/HttpProxyModule#proxy_ignore_client_abort) so
that requests that make it to the Rails 
app aren't aborted. Does anyone have experience with this? I can see it
causing its own sorts of confusion.

Jesse

_______________________________________________
Unicorn mailing list - [email protected]
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

Reply via email to