[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Diff can't find its temp file - regression in trunk since 1.5.4

From: Greg Stein <gstein_at_gmail.com>
Date: Thu, 6 Nov 2008 20:11:48 -0800

Gah... I've tracked this down to an APR bug.

Sigh.

What a freakin' bitch to find, too.

Here is the basic story of what is happening:

* RA needs a temp file to spool a request body, gets a temp file
(delete on close). Call it TEMPFILE.
* RA writes into that file, later it will be rewound, and passed to
Neon for sending up to the server
* The first external diff happens and the "child pool cleanup"
executes. This closes and unlinks the file.
* RA has no problem. It still has an open file handle.
* The diff processing code needs a temporary file. Gets TEMPFILE since
it is no longer present.
* Fork off a diff process. Child cleanup code runs for the ORIGINAL
TEMPFILE request -- closes and unlinks the file.
* diff process no longer sees the file.

The problem here is that the child unlinks the file. It should close
it, but NOT unlink it. This is a core bug in APR.

Net effect: if we have any code with APR_DELONCLOSE, *and* the file
spans a subprocess creation, then it could invoke this bug.

We can probably switch these to deleting upon pool cleanup. The only
"real" difference is stacking up temp files for longer than before,
but the pools should eventually go away, and the tempfiles should
disappear.

I'm going to audit all of our DELONCLOSE usage now.

What a bitch...

Cheers,
-g

On Mon, Nov 3, 2008 at 6:46 AM, Julian Foad <julianfoad_at_btopenworld.com> wrote:
> On Mon, 2008-11-03 at 07:42 -0600, Hyrum K. Wright wrote:
>> Julian Foad wrote:
>> > On Mon, 2008-11-03 at 11:08 +0000, Julian Foad wrote:
>> >> Bug: A repos-repos diff of two or more modified files fails on the
>> >> second file with a problem accessing a local temporary file.
>> >>
>> >> Using trunk_at_34019 over HTTP (neon):
>> >>
>> >> [[[
>> > [...]
>> >> diff: /tmp/tempfile.5.tmp: No such file or directory
>> >> /home/julianfoad/src/subversion-trunk/subversion/libsvn_subr/io.c:2266:
>> >> (apr_err=200012)
>> >> svn: '/home/julianfoad/bin/svn-external-diff' returned 2
>> >> /home/julianfoad/src/subversion-trunk/subversion/libsvn_ra_neon/util.c:1240: (apr_err=175002)
>> >> svn: Error reading spooled REPORT request response
>> >> ]]]
>> >
>> > As you can see, I'm using an external diff. Here's a more direct way to
>> > reproduce it, avoiding my "svn-external-diff" script:
>> >
>> > [[[
>> > $ # The directory '/tmp/svn-null-config' does not exist.
>> > $ # The external command 'diff' is GNU diff 2.8.7, found in my PATH.
>> > $ svn --config-dir /tmp/svn-null-config diff -c34003 $SVN_REPOS
>> > --diff-cmd=diff
>> > Index: trunk/subversion/include/svn_auth.h
>> > ===================================================================
>> > --- trunk/subversion/include/svn_auth.h (revision 34002)
>> > +++ trunk/subversion/include/svn_auth.h (revision 34003)
>> > [...the diff of this first file is fine...]
>> > Index: trunk/subversion/libsvn_ra_serf/serf.c
>> > ===================================================================
>> > diff: /tmp/tempfile.5.tmp: No such file or directory
>> > /home/julianfoad/src/subversion-tc3/subversion/libsvn_subr/io.c:2266:
>> > (apr_err=200012)
>> > svn: 'diff' returned 2
>> > /home/julianfoad/src/subversion-tc3/subversion/libsvn_ra_neon/util.c:1240: (apr_err=175002)
>> > svn: Error reading spooled REPORT request response
>> > ]]]
>>
>> If I had to guess, I'd say that it's related to r33977. All of the changes in
>> that rev were supposed to be idempotent, but that may not be true. (Or,
>> something was relying upon implementation-specific functionality which wasn't in
>> the public API.)
>
> Testing...
>
> r33977 exhibits this bug.
>
> r33976 does not.
>
> Looks like you're right. Thanks.
>
> - Julian
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
> For additional commands, e-mail: dev-help_at_subversion.tigris.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-11-07 05:12:09 CET

This is an archived mail posted to the Subversion Dev mailing list.