From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS14383 205.234.109.0/24 X-Spam-Status: No, score=-0.7 required=5.0 tests=MSGID_FROM_MTA_HEADER, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 Path: news.gmane.org!not-for-mail From: Brian Underwood Newsgroups: gmane.comp.lang.ruby.unicorn.general Subject: Forking for background processing with rails/unicorn Date: Wed, 16 Feb 2011 08:06:36 -0500 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1297862521 21584 80.91.229.12 (16 Feb 2011 13:22:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 16 Feb 2011 13:22:01 +0000 (UTC) To: mongrel-unicorn@rubyforge.org Original-X-From: mongrel-unicorn-bounces@rubyforge.org Wed Feb 16 14:21:55 2011 Return-path: Envelope-to: gclrug-mongrel-unicorn@m.gmane.org X-Original-To: mongrel-unicorn@rubyforge.org Delivered-To: mongrel-unicorn@rubyforge.org X-BeenThere: mongrel-unicorn@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: mongrel-unicorn-bounces@rubyforge.org Errors-To: mongrel-unicorn-bounces@rubyforge.org Xref: news.gmane.org gmane.comp.lang.ruby.unicorn.general:853 Archived-At: Received: from rubyforge.org ([205.234.109.19]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PphKJ-000314-2l for gclrug-mongrel-unicorn@m.gmane.org; Wed, 16 Feb 2011 14:21:51 +0100 Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id 3D2303C8045; Wed, 16 Feb 2011 08:21:50 -0500 (EST) Received: from mail-fx0-f50.google.com (mail-fx0-f50.google.com [209.85.161.50]) by rubyforge.org (Postfix) with ESMTP id 66DAC18581F3 for ; Wed, 16 Feb 2011 08:06:58 -0500 (EST) Received: by fxm14 with SMTP id 14so1374742fxm.23 for ; Wed, 16 Feb 2011 05:06:58 -0800 (PST) Received: by 10.223.74.143 with SMTP id u15mr718714faj.27.1297861618489; Wed, 16 Feb 2011 05:06:58 -0800 (PST) Received: by 10.223.75.202 with HTTP; Wed, 16 Feb 2011 05:06:36 -0800 (PST) Hello, I've been working for a few days on a problem which, after tracking it down, seems to be related to unicorn. I'm hoping that somebody might be able to help with information about what's going on. In the Rails 3 application that I support, we sometimes fork during a web request in order to do background processing behind the scenes without the user (and the browser connection) to wait for it to finish. I realize that a better method would be to have a queue of jobs to be processed (I even created a gem called job_boss which works well for our case), but it will take us a while to get there, so I'm trying to fix this for now. The problem that I'm finding is that, when I fork, the HTTP connection doesn't close. IE doesn't handle this as well and the browser is left sitting, waiting for the child process to finish rather than being redirected. This functionality worked fine in our application when we were using Rails 2.3.5 and Unicorn 1.1.3, but broke when we moved to Rails 3 and Unicorn 3.0.0 (we've since moved to Unicorn 3.4.0 and the problem remains, I had some hope that Unicorn 3.3.1 might have addressed it). I've been able to solve this problem temporarily by closing two file descriptors manually (#3 and, depending on the version of Rails #6 or #7). Obviously this is not ideal. I found the UNICORN_FD environment variable when looking through the Unicorn source, but that only seems to indicate #3. Where might #6/#7 be coming from? Is there some way that I can determine these without hard-coding the FD #? Any help that you can provide would be greatly appreciated, Brian Underwood Software Systems Engineer RBM Technologies, Inc. 215 1st St=A0 =B7=A0 Cambridge, MA 02142 call=A0 (617) 401-4666 visit www.rbmtechnologies.com The Power Behind the Planogram=99 "This email and any of its attachments may contain proprietary information, which is privileged, confidential, or subject to copyrights belonging to RBM Technologies, Inc. This email is intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient of this email, you are hereby notified that any dissemination, distribution, copying, or action taken in relation to the contents of and attachments to this is strictly prohibited and may be unlawful. If you have received this email in error, please notify the sender immediately and permanently delete the original and any copy of this email and any printout. Thank you." _______________________________________________ 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