You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2007/10/12 00:22:27 UTC

Threading in mod_dav_svn

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@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

Re: Threading in mod_dav_svn

Posted by Justin Erenkrantz <ju...@erenkrantz.com>.
On Oct 11, 2007 5:22 PM, David Glasser <gl...@davidglasser.net> wrote:
> So is it ever possible for two threads to share the same r->connection->pool?

No.  -- justin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org