From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.140.140.3 with SMTP id n3cs386819rvd; Sun, 7 Mar 2010 06:28:19 -0800 (PST) Received-SPF: pass (google.com: domain of 3AbiTSwcLCpg9625AMK9625AMK.4GEJ24C-56N6D8GG8D68JGMHK.4GE@groups.bounces.google.com designates 10.224.118.145 as permitted sender) client-ip=10.224.118.145; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 3AbiTSwcLCpg9625AMK9625AMK.4GEJ24C-56N6D8GG8D68JGMHK.4GE@groups.bounces.google.com designates 10.224.118.145 as permitted sender) smtp.mail=3AbiTSwcLCpg9625AMK9625AMK.4GEJ24C-56N6D8GG8D68JGMHK.4GE@groups.bounces.google.com; dkim=pass header.i=3AbiTSwcLCpg9625AMK9625AMK.4GEJ24C-56N6D8GG8D68JGMHK.4GE@groups.bounces.google.com Received: from mr.google.com ([10.224.118.145]) by 10.224.118.145 with SMTP id v17mr1174931qaq.22.1267972098683 (num_hops = 1); Sun, 07 Mar 2010 06:28:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=beta; h=domainkey-signature:received:x-beenthere:received:received:received :received:received-spf:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to :x-original-authentication-results:x-original-sender:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :x-thread-url:x-message-url:sender:list-subscribe:list-unsubscribe :content-type:content-transfer-encoding; bh=+KvWwWYQhJHkcaEfSFo7XQbnnW7L0Xhc3+x3Via5iSM=; b=6bf7ePzhxmjEsribRi5ZOZdU1pI0+K+7MGdgSLwpQEbQeNM8xaeSGRrOQ8YWsr2aka A04FcJOvDep5T1B8E+nhIho96yZ6XAp82NZuaqabK6lIN8LWKkExmcEOYLDt2MUNudys XtftLaaxpri/SbfwT1I7/CZue4Lkq1BAY4j6Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlegroups.com; s=beta; h=x-beenthere:received-spf:mime-version:in-reply-to:references:from :date:message-id:subject:to:x-original-authentication-results :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:x-thread-url:x-message-url:sender :list-subscribe:list-unsubscribe:content-type :content-transfer-encoding; b=Z83Dnj0QXDO3p92nttbvyg2IUcx9KX/HQ7eBFM/u4LZs2DSI5nK58sMg7uQUWAC7A7 dgyciCAYteq8QC74itUWpzcKFAWl0kZExfpwtF/a6N8xxt0amdmadTc+QeSI6jLx4ZaK vwpowVlJm039l6LVRseom9Wq0/f66SBojKizU= Received: by 10.224.118.145 with SMTP id v17mr125576qaq.22.1267972097352; Sun, 07 Mar 2010 06:28:17 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.224.88.1 with SMTP id y1ls2606148qal.3.p; Sun, 07 Mar 2010 06:28:15 -0800 (PST) Received: by 10.224.26.98 with SMTP id d34mr431600qac.17.1267972095564; Sun, 07 Mar 2010 06:28:15 -0800 (PST) Received: by 10.224.26.98 with SMTP id d34mr431599qac.17.1267972095534; Sun, 07 Mar 2010 06:28:15 -0800 (PST) Return-Path: Received: from qw-out-2122.google.com (qw-out-2122.google.com [74.125.92.26]) by gmr-mx.google.com with ESMTP id 18si830232qyk.4.2010.03.07.06.28.15; Sun, 07 Mar 2010 06:28:15 -0800 (PST) Received-SPF: pass (google.com: domain of headius@headius.com designates 74.125.92.26 as permitted sender) client-ip=74.125.92.26; Received: by qw-out-2122.google.com with SMTP id 3so713908qwe.5 for ; Sun, 07 Mar 2010 06:28:15 -0800 (PST) MIME-Version: 1.0 Received: by 10.224.107.193 with SMTP id c1mr1760129qap.67.1267972095413; Sun, 07 Mar 2010 06:28:15 -0800 (PST) In-Reply-To: <20100306075548.GB6474@dcvr.yhbt.net> References: <20100306075548.GB6474@dcvr.yhbt.net> From: Charles Oliver Nutter Date: Sun, 7 Mar 2010 08:27:55 -0600 Message-ID: Subject: Re: Not cleaning up tempfiles for multipart? To: rack-devel@googlegroups.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of headius@headius.com designates 74.125.92.26 as permitted sender) smtp.mail=headius@headius.com X-Original-Sender: headius@headius.com Reply-To: rack-devel@googlegroups.com Precedence: list Mailing-list: list rack-devel@googlegroups.com; contact rack-devel+owners@googlegroups.com List-ID: List-Post: , List-Help: , List-Archive: X-Thread-Url: http://groups.google.com/group/rack-devel/t/6eb2bc7a1f8c072c X-Message-Url: http://groups.google.com/group/rack-devel/msg/b9ca1b1404a416b8 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sat, Mar 6, 2010 at 1:55 AM, Eric Wong wrote: > Charles Oliver Nutter wrote: >> If I'm correct, this is a bug. Tempfiles should not be relied upon to >> clean themselves up in response to GC, since you don't know when GC >> will fire... > > Why not? =C2=A0Tempfiles are objects, too. =C2=A0It's perfectly reasonabl= e > to let GC clean them up like any other object. > > > I don't know why RewindableInput is monkeying with Tempfile internals, > though. It's roundly considered by every programming language community in the world to be *really* bad form to let GC clean up IO. There's tons of reasons for this: * GC may not run as soon as you like, causing you to hold IO resources too long (and under heavy load, potentially use up all descriptors for a process) * On some systems, old objects get promoted to heaps that are only rarely collected, resulting in them potentially never GCing (or only GCing extremely rarely) * There's no reason you *shouldn't* be able to close resources when they're no longer used. In this case, close any files opened for a give request once the request has been processed (async libraries using those files should expect them to be closed and deal with that accordingly). Bug-finding tools for several languages flag this sort of behavior as a high-priority bug. Languages like Go, C#, and Java have or are adding features to help guarantee you never do this. It's pretty much universally frowned upon. When I tweeted about Rubyists leaving IO objects to be cleaned up or closed by GC, *everyone* agreed that it's a bug in the code, and that nobody should ever rely on GC to release File/IO resources. What more can I say? :) - Charlie