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

Threading in mod_dav_svn

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-10-12 02:22:27 CEST

I'm trying to track down some FSFS corruptions. I am looking at this
bit of mod_dav_svn/repos.c(getresource):

  /* Retrieve/cache open repository */
  repos_key = apr_pstrcat(r->pool, "mod_dav_svn:", fs_path, NULL);
  apr_pool_userdata_get(&userdata, repos_key, r->connection->pool);
  repos->repos = userdata;
  if (repos->repos == NULL)
    {
      serr = svn_repos_open(&(repos->repos), fs_path, r->connection->pool);
      if (serr != NULL)
        {
          /* The error returned by svn_repos_open might contain the
             actual path to the failed repository. We don't want to
             leak that path back to the client, because that would be
             a security risk, but we do want to log the real error on
             the server side. */
          return dav_svn__sanitize_error(serr, "Could not open the requested "
                                         "SVN filesystem",
                                         HTTP_INTERNAL_SERVER_ERROR, r);
        }

      /* Cache the open repos for the next request on this connection */
      apr_pool_userdata_set(repos->repos, repos_key,
                            NULL, r->connection->pool);
    }

OK, so svn_repos_t's are cached inside the userdata of
"r->connection->pool". "r" here is a request_rec (defined in
httpd.h).

My question is: is it ever possible for multiple threads to be sharing
the same r->connection->pool?

Because if it is, then the threads will share the same repos, and thus
share the same svn_fs_t, and thus (for FSFS) the same
dir_cache/dir_cache_id/dir_cache_pool (not to mention the other caches
I added this week).

And access to these caches is neither atomic nor protected by a mutex.
 Which certainly strikes me as bad.

So is it ever possible for two threads to share the same r->connection->pool?

--dave

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Oct 12 02:22:37 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.