You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "C.A.T.Magic" <c....@gmx.at> on 2004/05/09 17:40:16 UTC

Re: [bug] FSFS errors when doing simultaneous commits - win32 apr_file_mktemp is broken

Josh Pieper wrote:
> C.A.T.Magic wrote:
> 
>>which means that apr_file_mktemp is failing -
>>maybe a bug in apr for win32?
> 
> C.A.T.:  Do you think you could figure out why apr_file_mktemp is
> failing?  Perhaps find the exact error code it is returning?

please change the flags for apr_file_mktemp in fsfs.c to
    APR_CREATE | APR_READ | APR_WRITE | APR_EXCL
because otherways apr always fails with EACCES on win32.


i debugged into the APR code and from what i see, i can tell
that apr's "gettemp" implementation is doint it quite
ineffective: it takes the "current time" and used that as a
seed for its random files --- which then collides quite often
if two processes (e.g HyperThread CPU) generate a temp file at 
approximately the same time. its also generating "Foo" and fOO"
which are identical for win32.
it then tries to create the same filename in both threads and
fails with errorcode
   720080 -- The file exists
which is probably the most senseless thing a generate unique
file function could ever return :)

since apr is broken this way, you should probably remove
all uses of apr_file_mktemp from svn, since you can't expect
all users to have the newest apr-fixes.
can someone point that behaviour out on the apr mailing list?


=======
c.a.t.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [bug] FSFS errors when doing simultaneous commits - win32 apr_file_mktemp is broken

Posted by rb...@rkbloom.net.
I have forwarded this to the APR dev list.

Ryan

On Sun, 9 May 2004, C.A.T.Magic wrote:

> C.A.T.Magic wrote:
> > Josh Pieper wrote:
> >
> >> C.A.T.Magic wrote:
> [...]
> >>> which means that apr_file_mktemp is failing -
> >>> maybe a bug in apr for win32?
> [...]
> > fails with errorcode
> >   720080 -- The file exists
> > which is probably the most senseless thing a generate unique
> > file function could ever return :)
> [...]
>
> maybe a simple minded aproach will do a better job:
> (pseudocode)
>    int r = head_revision;
>    int t = 1;
>    while ( mkdir("$r-$t")==DIR_EXISTS ) t++;
>
> :)
> =======
> c.a.t.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [bug] FSFS errors when doing simultaneous commits - win32 apr_file_mktemp is broken

Posted by "C.A.T.Magic" <c....@gmx.at>.
Josh Pieper wrote:
> C.A.T.Magic wrote:
> 
>>maybe a simple minded aproach will do a better job:
>>(pseudocode)
>>  int r = head_revision;
>>  int t = 1;
>>  while ( mkdir("$r-$t")==DIR_EXISTS ) t++;

> This is essentially what I did by using svn_io_open_unique_file.  Try
> r9662 and see how it goes.

great, that finally solved all the commit problems :)


but noticed 2 more things:
its always starting with an "_2" suffix (never _0 or _1)
and it would be safer to test for the 3243_2.txn _directory_
directly instead of testing for a _file_ first.
because if things go bad, then there is an existing
   3242_2.txn directory but no 3242_2 temp-file, which would
lead to permanent commit errors.  svn_io_open_unique_dir ?  :)


thanks
:-)
c.a.t.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [bug] FSFS errors when doing simultaneous commits - win32 apr_file_mktemp is broken

Posted by Josh Pieper <jj...@pobox.com>.
C.A.T.Magic wrote:
> maybe a simple minded aproach will do a better job:
> (pseudocode)
>   int r = head_revision;
>   int t = 1;
>   while ( mkdir("$r-$t")==DIR_EXISTS ) t++;
> 
> :)

This is essentially what I did by using svn_io_open_unique_file.  Try
r9662 and see how it goes.

-Josh

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [bug] FSFS errors when doing simultaneous commits - win32 apr_file_mktemp is broken

Posted by "C.A.T.Magic" <c....@gmx.at>.
C.A.T.Magic wrote:
> Josh Pieper wrote:
> 
>> C.A.T.Magic wrote:
[...]
>>> which means that apr_file_mktemp is failing -
>>> maybe a bug in apr for win32?
[...]
> fails with errorcode
>   720080 -- The file exists
> which is probably the most senseless thing a generate unique
> file function could ever return :)
[...]

maybe a simple minded aproach will do a better job:
(pseudocode)
   int r = head_revision;
   int t = 1;
   while ( mkdir("$r-$t")==DIR_EXISTS ) t++;

:)
=======
c.a.t.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org