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

WIN32_RETRY_LOOP and opening read-only files for writing.

From: Lieven Govaerts <svnlgo_at_mobsol.be>
Date: Mon, 1 Mar 2010 16:29:02 +0100

Hi,

I maintain some merge scripts written in Java that work with both
SVNKit and JavaHL. During unit testing on Windows XP we noticed that
some simple svn actions, like checkout take an extraordinary amount of
time. E.g. 'svn checkout' over ra_local of a branch with 3 folders and
6 100 bytes files takes appr. 20 seconds.

After some debugging we found that svn spends almost 15 seconds trying
to change a simple username file in ~\Subversion\auth\svn.username
(see attached extract of the Process Monitor log). It turns out this
file already existed and was set read-only. When JavaHL/svn creates
this file it makes it writeable, but SVNKit seems to create it as
read-only - which I suspect is a bug in SVNKit.

Looking at the Process Monitor output I suppose these 15 seconds are
spent in WIN32_RETRY_LOOP, defined in libsvn_subr/io.c.

WIN32_RETRY_LOOP tries in this case to open the file for writing, and
gets an ERROR_ACCESS_DENIED error. Now I know this error can mean lots
of things, so I don't propose to drop it altogether. But can't we add
a check that, if svn gets this error during file opening, it checks
first if the file is read-only before retrying 100 times?

I see we already do something similar in svn_io_remove_file.

Remarks?

Lieven

-----------------------------------------------------------------
14:58:58,4206273 javaw.exe 5976 CreateFile C:\Documents and
Settings\govaerl\Application
Data\Subversion\auth\svn.username\bfb50728e2262148ad4928381c7940bc ACCESS
DENIED
Desired Access: Generic Write, Read Attributes, Disposition:
OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File,
Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0
14:58:58,4207628 javaw.exe 5976 CreateFile C:\Documents and
Settings\govaerl\Application Data\Subversion\auth\svn.username SUCCESS
Desired Access: Synchronize, Disposition: Open, Options: Directory,
Synchronous IO Non-Alert, Open For Backup, Attributes: N, ShareMode:
Read, Write, AllocationSize: n/a, OpenResult: Opened
14:58:58,4212682 javaw.exe 5976 CloseFile C:\Documents and
Settings\govaerl\Application Data\Subversion\auth\svn.username SUCCESS

14:58:58,4268767 javaw.exe 5976 CreateFile C:\Documents and
Settings\govaerl\Application
Data\Subversion\auth\svn.username\bfb50728e2262148ad4928381c7940bc ACCESS
DENIED Desired Access: Generic Write, Read Attributes, Disposition:
OverwriteIf, Options: Synchronous IO Non-Alert, Non-Directory File,
Attributes: n/a, ShareMode: Read, Write, Delete, AllocationSize: 0
14:58:58,4270108 javaw.exe 5976 CreateFile C:\Documents and
Settings\govaerl\Application
Data\Subversion\auth\svn.username SUCCESS Desired Access: Synchronize,
Disposition: Open, Options: Directory, Synchronous IO Non-Alert, Open
For Backup, Attributes: N, ShareMode: Read, Write, AllocationSize:
n/a, OpenResult: Opened
14:58:58,4271387 javaw.exe 5976 CloseFile C:\Documents and
Settings\govaerl\Application Data\Subversion\auth\svn.username SUCCESS
...
Received on 2010-03-01 16:29:57 CET

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.