httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MySoLo <mys...@cynetek.com>
Subject Failure request with apr dbd and postgresql
Date Thu, 02 Apr 2009 22:28:17 GMT
Hi all,

I'm writing a module with apr dbd ( and mod_dbd for initialize dbd ).
post_read hook is used for dbd_acquire_fn , get statement, pvselect,
etc....

When use dbd with DBDriver pgsql , request fail after 5, 6 wget test,
after two with firefox refresh. No problem  with driver sqlite3 or
mysql. oracle, freetds or other are not tested.

Simple config for mod_dbd is:

        DBDriver pgsql
        DBDParams "dbname=vhost user=vhost password=vhost"


With postgresql 7.4 if use  DBDPersist off but if not use or force on
i'm error (idem with postgresql 8.3):

ex test: portoo ~ # wget -O index.html "http://vhost0.com"
vhost0.com is local :)

[Thu Apr 02 23:40:10 2009] [debug] mod_vhost_dbd.c(357): [client
192.168.100.1] vhost_dbd_post_read: path=/home/mysolo/test/vhost0
<----------- it's ok
.......
[Thu Apr 02 23:40:13 2009] [error] [client 192.168.100.1] Query
execution error looking up 'vhost0.com' in database
[Thu Apr 02 23:40:13 2009] [error] [client 192.168.100.1] another
command is already in progress\n

and if use DBDPersit off with postgresql 8.3 , it's error

[Fri Apr 03 00:16:16 2009] [error] (20014)Internal error: DBD: Can't
connect to pgsql
[Fri Apr 03 00:16:16 2009] [error] [client 192.168.100.1] Failed to
acquire database connection to look up host 'vhost0.com'

apr-util bug or bug in pqlib  of postgresql.  I'm searching bug list of
apr/apache or postgresql , or google and don't found response.

Helping for found problem with postgresql.

complete code is on https://svn.cynetek.com/pub/mod_vhost_dbd/trunk/

Excuse me for my english. I speak french only :)


I'm use standard code for acquire, get statement and pvselect.
....
    dbd = vhost_dbd_acquire_fn(r);
    if (dbd == NULL) {
    	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Failed to acquire
database connection to look up host '%s'", host);
    	return DECLINED;
    }

    statement = apr_hash_get(dbd->prepared, conf->label,
APR_HASH_KEY_STRING);
    if (statement == NULL) {
    	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "A prepared statement
could not be found for "
    			"VhostDBDQuery with the key '%s'", conf->label);
    	return DECLINED;
    }

    /* execute the query of a statement and parameter host */
    if (rv = apr_dbd_pvselect(dbd->driver, r->pool, dbd->handle, &res,
statement, 0, host, NULL) != 0) {
    	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Query execution error
looking up '%s' in database", host);
    	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
apr_dbd_error(dbd->driver, dbd->handle, rv));

    	return DECLINED;
    }

    //   ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
"vhost_dbd_post_read: apr_dbd_get_row return : %d", rv);
    if (rv = apr_dbd_get_row(dbd->driver, r->pool, res, &row, -1)) {
    	ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "No found results for
host '%s' in database", host);
    	ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "vhost_dbd_post_read:
result of apr_dbd_get_row=%d", rv);
    	return DECLINED;
    }



Mime
View raw message