You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Ben Collins-Sussman <su...@collab.net> on 2005/03/11 22:55:47 UTC
svnserve pools and svn_fs_access_t
I'm trying to make svnserve imitate mod_dav_svn here, but having
problems.
In mod_dav_svn, we cache the svn_fs_t in a "global" pool, specifically
the connection's pool. As each http request comes in, we grab the
authenticated username attached to it, create a new svn_fs_access_t
object in r->pool, then attach the access_t to the svn_fs_t. We
register a cleanup handler on r->pool, so that when the request dies,
so does the access_t. This is the proper lifetime for authentication;
a request comes in with a username (and possibly lock-tokens), and the
authentication only lasts as long as the request itself.
We need svnserve to do the same thing. Luckily, it behaves much like
apache. There's a "global" pool (the one in the server_baton_t) which
holds the svn_fs_t, and when each new client command comes in, the
command is processed using a subpool.
At the moment, though, the lifetime of the access_t is inconsistent.
If the auth-challenge happens inside of a command handler, then
auth_request() is called using the command's subpool, and the access_t
is allocated in the subpool. When the subpool is cleared, the global
svn_fs_t points to a de-alloc'd svn_fs_access_t (ugh!). If the
auth-challenge happens up-front before any commands are executed, then
auth_request() is called using the global pool, and the access_t ends
up allocated in the global pool, persisting across multiple commands
(also bad.)
I'm not sure how to fix this. Any suggestions from those who know
svnserve better? Lundblad, ghudson, etc.?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svnserve pools and svn_fs_access_t
Posted by "Peter N. Lundblad" <pe...@famlundblad.se>.
[Summarizing some IRC discussions with ghudson.]
On Fri, 11 Mar 2005, Greg Hudson wrote:
> On Fri, 2005-03-11 at 17:55, Ben Collins-Sussman wrote:
> > I'm not sure how to fix this. Any suggestions from those who know
> > svnserve better? Lundblad, ghudson, etc.?
>
> A similar issue exists for the "user" field of the server baton
> structure. (I thought someone had fixed this, but apparently not, or
> perhaps only on the locking branch.)
>
Actually, you and I discussed this on IRC. Since we didn't have any
reports on it, I didn't consider it worth fixing on trunk, but instead
added a TODO about it for the locking branch. That's what sussman works on
right now, including the access_t stuff.
> The server baton should have a pool field. When authentication happens,
> the username should be allocated either in that pool or in a subpool,
> and the FS access object should be allocated similarly.
>
sussman: I and ghudson discussed this on IRC and we concluded that the
username should be allocated in the connection pool, and the access_t
should live in the command subpool despite what is being said above.
NOte to others: The access_t has to be destroyed after each command, since
it stores lock tokens that has to be forgotten. That's why we can't keep
it for the whole session.
> (Since in practice, authentication doesn't happen more than one or two
> times per connection, using a subpool might be overkill. But
> technically it's a memory leak not to do so.)
>
Since the username is only acquired once from the client, this is not a
problem.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svnserve pools and svn_fs_access_t
Posted by Greg Hudson <gh...@MIT.EDU>.
On Fri, 2005-03-11 at 17:55, Ben Collins-Sussman wrote:
> I'm not sure how to fix this. Any suggestions from those who know
> svnserve better? Lundblad, ghudson, etc.?
A similar issue exists for the "user" field of the server baton
structure. (I thought someone had fixed this, but apparently not, or
perhaps only on the locking branch.)
The server baton should have a pool field. When authentication happens,
the username should be allocated either in that pool or in a subpool,
and the FS access object should be allocated similarly.
(Since in practice, authentication doesn't happen more than one or two
times per connection, using a subpool might be overkill. But
technically it's a memory leak not to do so.)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org