You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Nick Kew <ni...@webthing.com> on 2005/10/01 01:21:07 UTC

dbd connections tied to conn_rec

mod_dbd currently supports modules requiring a connection of an arbitrary
duration (explicit ap_dbd_open and ap_dbd_close), or tied to the request_rec
(ap_dbd_acquire, which releases the connection back to the reslist on request
pool cleanup).

Brian France's dbd modules for smtpd want the option that's missing from 
there: a dbd handle tied to the conn_rec.  Today I got around to hacking
that - patch attached.  Review invited - I'll commit to trunk if noone shouts.

-- 
Nick Kew

Re: dbd connections tied to conn_rec

Posted by "Brian J. France" <li...@firehawksystems.com>.
Not sure why yet, but for some reason I now have to do start/end 
transaction around around my sql calls (postgres).  Otherwise I will 
get a error "another command is already in progress" after the first 
connection, which I wasn't getting before.  After doing this all is 
working good (both with and without APR_HAS_THREADS set in mod_dbd.c).

While trying to debug this I found my original thought:

>> I think it might have to do with allocating a dbd from the connection
>> pool when it needs to be from the server pool for persist connections.
>> non-persist connection can use the connection pool.

was wrong as because it does the right thing inside of ap_dbd_open, but 
I do have a question about code in ap_dbd_open.  If the connection is 
not persist, should it use the passed in pool (the connection pool, 
request pool for acquire functions or temp pool if called directly) 
instead of the server pool?  Currently every thing with the DB handle 
will be closed correctly, but I think it will leak sizeof(ap_dbd_t) for 
each call of ap_dbd_open because that memory is cleaned up from the 
server pool (instead of connect, request or temp pool).

Brian


On Oct 1, 2005, at 4:33 AM, Nick Kew wrote:
> On Saturday 01 October 2005 01:26, Brian J. France wrote:
>> Thanks for the work!
>>
>> I am having problems with it on the second connection, first 
>> connection
>> works with multiple calls to ap_dbd_cacquire.
>>
>> I think it might have to do with allocating a dbd from the connection
>> pool when it needs to be from the server pool for persist connections.
>> non-persist connection can use the connection pool.
>>
>> I don't have time to dig into right now, but will try this weekend.
>
> Thanks for the feedback.  Are you running the patch against current SVN
> (i.e. after the fixes we made yesterday), or something older?


Re: dbd connections tied to conn_rec

Posted by Nick Kew <ni...@webthing.com>.
On Saturday 01 October 2005 01:26, Brian J. France wrote:
> Thanks for the work!
>
> I am having problems with it on the second connection, first connection
> works with multiple calls to ap_dbd_cacquire.
>
> I think it might have to do with allocating a dbd from the connection
> pool when it needs to be from the server pool for persist connections.
> non-persist connection can use the connection pool.
>
> I don't have time to dig into right now, but will try this weekend.

Thanks for the feedback.  Are you running the patch against current SVN
(i.e. after the fixes we made yesterday), or something older?

-- 
Nick Kew

Re: dbd connections tied to conn_rec

Posted by "Brian J. France" <li...@firehawksystems.com>.
Thanks for the work!

I am having problems with it on the second connection, first connection 
works with multiple calls to ap_dbd_cacquire.

I think it might have to do with allocating a dbd from the connection 
pool when it needs to be from the server pool for persist connections.  
non-persist connection can use the connection pool.

I don't have time to dig into right now, but will try this weekend.

Cheers,

Brian

On Sep 30, 2005, at 6:21 PM, Nick Kew wrote:

> mod_dbd currently supports modules requiring a connection of an 
> arbitrary
> duration (explicit ap_dbd_open and ap_dbd_close), or tied to the 
> request_rec
> (ap_dbd_acquire, which releases the connection back to the reslist on 
> request
> pool cleanup).
>
> Brian France's dbd modules for smtpd want the option that's missing 
> from
> there: a dbd handle tied to the conn_rec.  Today I got around to 
> hacking
> that - patch attached.  Review invited - I'll commit to trunk if noone 
> shouts.
>
> -- 
> Nick Kew
> <dbd-patch>