You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Ruediger Pluem <rp...@apache.org> on 2006/07/23 23:35:31 UTC
Re: svn commit: r424798 - /httpd/httpd/trunk/modules/database/mod_dbd.c
On 07/23/2006 10:22 PM, niq@apache.org wrote:
> Author: niq
> Date: Sun Jul 23 13:22:57 2006
> New Revision: 424798
>
> URL: http://svn.apache.org/viewvc?rev=424798&view=rev
> Log:
> Remove dependence on server config from ap_dbd_prepare, as that may
> be called in per-directory config functions where there is no
> server context causing segfault.
> Discussion at
> http://mail-archives.apache.org/mod_mbox/httpd-dev/200607.mbox/<831327593.20060720023332%40engec.ru>
> and subsequent thread.
>
> - svr_cfg *svr = ap_get_module_config(s->module_config, &dbd_module);
> dbd_prepared *prepared = apr_pcalloc(s->process->pool, sizeof(dbd_prepared));
> prepared->label = label;
> prepared->query = query;
> - prepared->next = svr->prepared;
> - svr->prepared = prepared;
> + prepared->next = apr_hash_get(dbd_prepared_defns, s->server_hostname,
> + APR_HASH_KEY_STRING);
> + apr_hash_set(dbd_prepared_defns, s->server_hostname, APR_HASH_KEY_STRING,
> + prepared);
Is this thread save (concerns because dbd_prepared_defns is static)?
Regards
Rüdiger
Re: svn commit: r424798 - /httpd/httpd/trunk/modules/database/mod_dbd.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 07/23/2006 11:56 PM, Nick Kew wrote:
> No. ap_dbd_prepare is about preparing statements from httpd.conf.
> In request processing, you'd acquire a connection and use apr_dbd_*.
Thanks for clarification.
Regards
Rüdiger
Re: svn commit: r424798 - /httpd/httpd/trunk/modules/database/mod_dbd.c
Posted by Nick Kew <ni...@webthing.com>.
On Sunday 23 July 2006 22:53, Ruediger Pluem wrote:
> On 07/23/2006 11:41 PM, Nick Kew wrote:
> > Not relevant. It's only used to store definitions until post_config.
> > Note that dbd_prepared_defns itself is allocated on ptemp, too.
>
> Just for my clarification: ap_dbd_prepare is not called *after*
> post_config? (My assumption was that it might be called during request
> processing, hence my concern).
No. ap_dbd_prepare is about preparing statements from httpd.conf.
In request processing, you'd acquire a connection and use apr_dbd_*.
--
Nick Kew
Re: svn commit: r424798 - /httpd/httpd/trunk/modules/database/mod_dbd.c
Posted by Ruediger Pluem <rp...@apache.org>.
On 07/23/2006 11:41 PM, Nick Kew wrote:
>
> Not relevant. It's only used to store definitions until post_config.
> Note that dbd_prepared_defns itself is allocated on ptemp, too.
Just for my clarification: ap_dbd_prepare is not called *after* post_config?
(My assumption was that it might be called during request processing, hence
my concern).
Regards
Rüdiger
Re: svn commit: r424798 - /httpd/httpd/trunk/modules/database/mod_dbd.c
Posted by Nick Kew <ni...@webthing.com>.
On Sunday 23 July 2006 22:35, Ruediger Pluem wrote:
> > - svr_cfg *svr = ap_get_module_config(s->module_config, &dbd_module);
> > dbd_prepared *prepared = apr_pcalloc(s->process->pool,
> > sizeof(dbd_prepared)); prepared->label = label;
> > prepared->query = query;
> > - prepared->next = svr->prepared;
> > - svr->prepared = prepared;
> > + prepared->next = apr_hash_get(dbd_prepared_defns,
> > s->server_hostname, +
> > APR_HASH_KEY_STRING);
> > + apr_hash_set(dbd_prepared_defns, s->server_hostname,
> > APR_HASH_KEY_STRING, + prepared);
>
> Is this thread save (concerns because dbd_prepared_defns is static)?
Not relevant. It's only used to store definitions until post_config.
Note that dbd_prepared_defns itself is allocated on ptemp, too.
--
Nick Kew