[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-issues
Subject:    [Issue 3218]  improve WIN32_RETRY_LOOP on Cygwin
From:       Bert Huijben <rhuijben () sharpsvn ! net>
Date:       2008-12-26 22:46:35
Message-ID: 20081226224635.E94CD7B0262 () sc157-tigr ! sjc ! collab ! net
[Download RAW message or body]

http://subversion.tigris.org/issues/show_bug.cgi?id=3218



User rhuijben changed the following:

                What    |Old value                 |New value
================================================================================
              OS/Version|Windows XP                |other
--------------------------------------------------------------------------------




------- Additional comments from rhuijben@tigris.org Fri Dec 26 14:46:34 -0800 2008 -------
[Setting OS to other as there is no Windows/Cygwin OS]

The conversion of specific Windows error codes to APR_STATUS_IS_EACCES is not 
safe. It hides more errors by retrying them 100 times.

See http://cache.gmane.org//gmane/comp/version-control/subversion/devel/100514-
002.bin

--- subversion-1.4.5/subversion/libsvn_subr/io.c.orig	2008-05-27 
14:53:33.291201300 +0800
+++ subversion-1.4.5/subversion/libsvn_subr/io.c	2008-05-27 
14:56:39.983190300 +0800
@@ -71,18 +71,16 @@
   retry loop cannot completely solve this problem either, but can
   help mitigate it.
 */
-#ifdef WIN32
+#if defined(WIN32) || defined(__CYGWIN__)
 #define WIN32_RETRY_LOOP(err, expr)                                        \
   do                                                                       \
     {                                                                      \
-      apr_status_t os_err = APR_TO_OS_ERROR(err);                       \
       int sleep_count = 1000;                                              \
       int retries;                                                         \
       for (retries = 0;                                                    \
-           retries < 100 && (os_err == ERROR_ACCESS_DENIED                 \
-                             || os_err == ERROR_SHARING_VIOLATION          \
-                             || os_err == ERROR_DIR_NOT_EMPTY);            \
-           ++retries, os_err = APR_TO_OS_ERROR(err))                    \
+           retries < 100 && (APR_STATUS_IS_EACCES(err)                     \
+                             || APR_STATUS_IS_ENOTEMPTY(err));             \
+           ++retries)                                                      \
         {                                                                  \
           apr_sleep(sleep_count);                                       \
           if (sleep_count < 128000)                                        \


Translates a check on two errorcodes to a check on eleven errors.

#define APR_STATUS_IS_EACCES(s)         ((s) == APR_EACCES \
                || (s) == APR_OS_START_SYSERR + ERROR_ACCESS_DENIED \
                || (s) == APR_OS_START_SYSERR + ERROR_CANNOT_MAKE \
                || (s) == APR_OS_START_SYSERR + ERROR_CURRENT_DIRECTORY \
                || (s) == APR_OS_START_SYSERR + ERROR_DRIVE_LOCKED \
                || (s) == APR_OS_START_SYSERR + ERROR_FAIL_I24 \
                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_VIOLATION \
                || (s) == APR_OS_START_SYSERR + ERROR_LOCK_FAILED \
                || (s) == APR_OS_START_SYSERR + ERROR_NOT_LOCKED \
                || (s) == APR_OS_START_SYSERR + ERROR_NETWORK_ACCESS_DENIED \
                || (s) == APR_OS_START_SYSERR + ERROR_SHARING_VIOLATION)

I prefer to reduce the numbers of errors to retry on to the absolute minimum 
necessary.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=463&dsMessageId=993413

To unsubscribe from this discussion, e-mail: [issues-unsubscribe@subversion.tigris.org].
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic