apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Ingram <d...@dmi.me.uk>
Subject Re: Fwd: Re: apr_dbd_prepare() corrupts arguments on failure
Date Mon, 13 Oct 2008 09:56:31 GMT
Nick Kew wrote:
>>> This all appears to work fine if the statement is valid. If there is
>>> a problem (e.g. a syntax error in the SQL) then apr_dbd_prepare()
>>> seems to destroy its driver and handle arguments, as shown by the
>>> fprintf() output:
>> Use the ap_* methods to get diagnostics.  Not stdio.
Will do. The stdio was just a very quick way to get output - I'm still
kinda new to Apache/APR coding.

>> What happens if you compile with -O0?
Hmm, that's interesting. When I do that, apr_dbd_prepare() causes a
segfault, whereas without -O0, a subsequent call to apr_dbd_select()

Just to make sure, the call to apxs that I'm using is: apxs -c -i
-Wc,-O0 mod_sqltemplate.c

>> Just to check: you are doing all this in a command function, so it'll
>> run between
>> pre_config and post_config?
Yup. It's all being executed at configuration read time (hence I can't
use mod_dbd, as far as I know):

  AP_INIT_RAW_ARGS(BEGIN_SQLRPT, sqltemplate_rpt_section, NULL,
      "Beginning of a SQL repeating template section."),

Interestingly, running it using just apr_dbd_select() works (almost)
fine, although it does cause Apache to segfault later. I'm running
Apache using it's "config test" option (-t) to test my module, and this
later segfault happens after reporting "Syntax OK". I presume this is
when the config pool is being cleaned up. The later segfault appears to
happen in the mysql client library ("invalid free()/delete/delete[]",
according to valgrind) but I suspect that it's my fault instead.



View raw message