unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jesse Storimer <jstorimer@gmail.com>
To: mongrel-unicorn@rubyforge.org
Subject: What happens when a client terminates a connection?
Date: Mon, 8 Aug 2011 12:19:17 -0400	[thread overview]
Message-ID: <20110808161915.GA49811@jessebook-2.local> (raw)

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 - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying


             reply	other threads:[~2011-08-08 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-08 16:19 Jesse Storimer [this message]
2011-08-08 19:28 ` What happens when a client terminates a connection? Eric Wong
2011-08-08 20:13 ` Eric Wong
     [not found] <20110808193252.GA7188@dcvr.yhbt.net>
2011-08-08 21:17 ` Jesse Storimer
2011-08-08 21:47   ` Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110808161915.GA49811@jessebook-2.local \
    --to=jstorimer@gmail.com \
    --cc=mongrel-unicorn@rubyforge.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).