From mboxrd@z Thu Jan 1 00:00:00 1970 Delivered-To: chneukirchen@gmail.com Received: by 10.140.140.3 with SMTP id n3cs283943rvd; Fri, 5 Mar 2010 06:47:49 -0800 (PST) Received-SPF: pass (google.com: domain of 3khmRSwcLCogtqmpu64tqmpu64.o0y3mow-pq7qxs00sxqs30614.o0y@groups.bounces.google.com designates 10.224.116.210 as permitted sender) client-ip=10.224.116.210; Authentication-Results: mr.google.com; spf=pass (google.com: domain of 3khmRSwcLCogtqmpu64tqmpu64.o0y3mow-pq7qxs00sxqs30614.o0y@groups.bounces.google.com designates 10.224.116.210 as permitted sender) smtp.mail=3khmRSwcLCogtqmpu64tqmpu64.o0y3mow-pq7qxs00sxqs30614.o0y@groups.bounces.google.com; dkim=pass header.i=3khmRSwcLCogtqmpu64tqmpu64.o0y3mow-pq7qxs00sxqs30614.o0y@groups.bounces.google.com Received: from mr.google.com ([10.224.116.210]) by 10.224.116.210 with SMTP id n18mr57082qaq.38.1267800468527 (num_hops = 1); Fri, 05 Mar 2010 06:47:48 -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=2Y8C3XzBly8yWFLtKTZ+SolrQMIAGPWNoHx6n71MpKA=; b=EN9M0ge4NKZscOMyzB+rn12Rh/HYG9fas2ZKfx5u375ljKFl+KZKHj3qMFlVNJ7jTy yjSpo1KbwVrhT3U4PztsIK6mBksNrNRg3HW8VB7xRsKOAfJM8rDLFYzt4aNeuvdzFHZO 2jAzO9H/0ixPd+aYTWraYaud44ZBAC5A3Wp/g= 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=l31vG+VhlY4034v4JzbnnQNyHJp3v4vYH4ojv866PBV6DaMEm8p+Mr/Zzqq9ZRiaNM Xx+cERdbB0rKrDs41oWIaRDIORGQWcTrlyc2rdA/FxyV9/CFuuMf3VdXVWF6+goVeIjm XbThS/BY8yWYbOXJLY3G2OQnP2j58J4dk6EgQ= Received: by 10.224.116.210 with SMTP id n18mr5823qaq.38.1267800466925; Fri, 05 Mar 2010 06:47:46 -0800 (PST) X-BeenThere: rack-devel@googlegroups.com Received: by 10.224.88.1 with SMTP id y1ls1533967qal.3.p; Fri, 05 Mar 2010 06:47:45 -0800 (PST) Received: by 10.224.102.14 with SMTP id e14mr28626qao.3.1267800464796; Fri, 05 Mar 2010 06:47:44 -0800 (PST) Received: by 10.224.102.14 with SMTP id e14mr28625qao.3.1267800464769; Fri, 05 Mar 2010 06:47:44 -0800 (PST) Return-Path: Received: from mail-vw0-f52.google.com (mail-vw0-f52.google.com [209.85.212.52]) by gmr-mx.google.com with ESMTP id 25si169895qyk.3.2010.03.05.06.47.44; Fri, 05 Mar 2010 06:47:44 -0800 (PST) Received-SPF: pass (google.com: domain of headius@headius.com designates 209.85.212.52 as permitted sender) client-ip=209.85.212.52; Received: by vws1 with SMTP id 1so1111104vws.25 for ; Fri, 05 Mar 2010 06:47:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.220.122.193 with SMTP id m1mr655635vcr.34.1267800464226; Fri, 05 Mar 2010 06:47:44 -0800 (PST) In-Reply-To: References: From: Charles Oliver Nutter Date: Fri, 5 Mar 2010 08:47:24 -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 209.85.212.52 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/33116e33fd130933 Sender: rack-devel@googlegroups.com List-Subscribe: , List-Unsubscribe: , Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I'm also confused by this code in rewindable_input.rb: class Tempfile < ::Tempfile def _close @tmpfile.close if @tmpfile @data[1] =3D nil if @data @tmpfile =3D nil end end the original _close (in 1.8.7) does this, which should be functionally equivalent: def _close # :nodoc: @tmpfile.close if @tmpfile @tmpfile =3D nil @data[1] =3D nil if @data end Is this patching a bug from 1.8.6? FYI, in JRuby there is no _close, since it's a private impl method and we have our own tempfile implementation. - Charlie On Fri, Mar 5, 2010 at 8:40 AM, Charles Oliver Nutter wrote: > I'm investigating some reported tempfle bugs in JRuby, and it seems > like Rack may not be cleaning up tempfiles it uses. > > The creation of the tempfile happens at utils.rb line 486: > > =C2=A0 =C2=A0 =C2=A0if content_type || filename >>> =C2=A0 =C2=A0body =3D Tempfile.new("RackMultipart") > =C2=A0 =C2=A0 =C2=A0 =C2=A0body.binmode =C2=A0if body.respond_to?(:binmod= e) > =C2=A0 =C2=A0 =C2=A0end > > The body is then written to (with the content of the request body), > rewound, put into the "data" structure, passed to normalize_params > (which inserts the "data" into the params hash), and that's it. The > params are then presumably used for the request, and nobody ever > explicitly cleans up the tempfile. > > Am I looking in the wrong place? > > 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... > > - Charlie >