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

Is mod_dav_svn safe for use in a threaded MPM?

From: Malcolm Rowe <malcolm-svn-dev_at_farside.org.uk>
Date: 2007-04-05 18:02:53 CEST

Or, more precisely, which APR-util dbm implementations are safe to use
in a threaded MPM, if any?

mod_dav_svn maintains an activity database - a mapping of DAV-generated
identifiers to Subversion transaction id's. It implements this using
APR-util's dbm implementation, which may be BDB, gdbm, or one of several
other dbm-a-like implementations.

(Obviously, as BDB isn't safe to use by more than one user via NFS,
anyone considering using more than one mod_dav_svn server against the
same NFS filesystem should definitely not use the BDB implementation.
People with only one DAV server are probably safe. I guess.)

So the advice I've been giving people is to use the sdbm implementation,
which implements a pretty straightforward shared/exclusive
serialisation via fcntl() locks.

However, I've just noticed that there isn't any thread synchronisation
in sdbm, so I suspect that two threads can actually work together to
corrupt the activity database, given that POSIX locks are per-process.

So the upshot of this is that I _think_ we should be serialising our
apr_dbm_ open/read/close and open/write/close calls in
mod_dav_svn/activity.c against a per-process mutex. Not doing so means
that we're relying on the APR dbm implementation to provide thread
exclusion, which it doesn't appear to do.

Does this seem reasonable?

Regards,
Malcolm

  • application/pgp-signature attachment: stored
Received on Thu Apr 5 18:03:06 2007

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.