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

[Patch] Make neon initialization thread safe

From: Bert Huijben <B.Huijben_at_competence.biz>
Date: Fri, 15 Aug 2008 16:11:52 +0200


Some users think SharpSvn is a nice api to make parallel requests to
subversion servers. I received some crash reports lately and this patch
resolves at least the crash I could reproduce in a testcase.

This patch fixes a race condition if two neon requests are started
approximately at the same time. The first call starts initializing and
the second call thinks initialization is already completed.

Make the libsvn_ra_neon one time initialization thread safe by using
and stop calling it for every session.

* subversion/libsvn_ra_neon.c
  (neon_initialized): storage for initialization status

  (initialize_neon): Initialize neon in an atomic context

  (ensure_neon_initialized): Wrapper for calling initialize_neon via

  (svn_ra_neon__open): Call ensure_neon_initialized instead of
   Neon on every request.

Patch by: Bert Huijben <b.huijben_at_competence.biz>

ne_sock_init() is defined as:

/* Perform process-global initialization of any libraries in use.
 * Returns non-zero on error. */
int ne_sock_init(void);

(So we don't have to call it on every session)

The serf library has a similar race condition; but that is completely in
the serf library code; not in libsvn_ra_serv. (Already discussed on irc)



To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org

Received on 2008-08-15 16:12:09 CEST

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.