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

Race in svn_atomic_namespace__create

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Mon, 29 Oct 2012 16:36:36 +0000

I'm getting random regression test fails in parallel mode due to a race
in svn_atomic_namespace__create:

W: ERROR: dump failed: ../src/subversion/libsvn_fs_fs/fs_fs.c:3220: (apr_err=160052)
W: ERROR: dump failed: svnadmin: E160052: Revprop caching for 'svn-test-work/local_tmp/repos/db' disabled because SHM infrastructure for revprop caching failed to initialize.
W: ERROR: dump failed: ../src/subversion/libsvn_fs_fs/fs_fs.c:3171: (apr_err=17)
W: ERROR: dump failed: ../src/subversion/libsvn_subr/named_atomic.c:430: (apr_err=17)
W: ERROR: dump failed: svnadmin: E000017: Can't get shared memory for named atomics: File exists

The code does

  /* First, look for an existing shared memory object. If it doesn't
   * exist, create one.
  apr_err = apr_shm_attach(&shared_mem, shm_name, result_pool);
  if (apr_err)
      apr_err = apr_shm_create(&shared_mem,
      if (apr_err)
        return unlock(&new_ns->mutex,
                          _("Can't get shared memory for named atomics")));

and between the failed attach and the create another process could
create the segment.

I can't see any order in which we can do attach/create that doesn't have
a similar race. I think the best solution is a short loop trying
attach-create a few times before giving up.

Join us this October at Subversion Live 2012
Received on 2012-10-29 17:37:15 CET

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