You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2006/12/10 13:26:45 UTC

DO NOT REPLY [Bug 41141] New: - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141

           Summary: mod_dbd, apr_dbd_pgsql: Error looking up ... in database
                    mod_dbd, apr_dbd_pgsql: Error looking up ... in database
           Product: Apache httpd-2
           Version: 2.2.3
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Keywords: PatchAvailable
          Severity: critical
          Priority: P2
         Component: Other Modules
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: jens@strawberry.com


The authorization using DBD/PGSQL is broken at least in version 2.2.3.
Debugging the code I foigured out, that in dbd_setup_lock a failure
return code is generated if srv->mutex contains the NULL value. This
is incorrect, because the NULL value may also be assigned in success
cases if no mutexes are required (see: dbd_setup_init in the same
source file). I've created the following patch which works fine for
me:


*** ./modules/database/mod_dbd.c.fcs    Sun Dec 10 12:19:47 2006
--- ./modules/database/mod_dbd.c        Sun Dec 10 12:22:01 2006
***************
*** 388,416 ****
      /* several threads could be here at the same time, all trying to
       * initialize the reslist because dbd_setup_init failed to do so
       */
!     if (!svr->mutex) {
!         /* we already logged an error when the mutex couldn't be created */
!         return APR_EGENERAL;
      }

-     rv = apr_thread_mutex_lock(svr->mutex);
-     if (rv != APR_SUCCESS) {
-         ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, pool,
-                       "DBD: Failed to acquire thread mutex");
-         return rv;
-     }
-
      if (!svr->dbpool) {
          rv2 = dbd_setup(s->process->pool, svr);
      }

!     rv = apr_thread_mutex_unlock(svr->mutex);
!     if (rv != APR_SUCCESS) {
!         ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, pool,
!                       "DBD: Failed to release thread mutex");
!         if (rv2 == APR_SUCCESS) {
!             rv2 = rv;
!         }
      }
      return rv2;
  }
--- 388,415 ----
      /* several threads could be here at the same time, all trying to
       * initialize the reslist because dbd_setup_init failed to do so
       */
!     if (svr->mutex) {
!       rv = apr_thread_mutex_lock(svr->mutex);
!       if (rv != APR_SUCCESS) {
!           ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, pool,
!                         "DBD: Failed to acquire thread mutex");
!           return rv;
!       }
      }

      if (!svr->dbpool) {
          rv2 = dbd_setup(s->process->pool, svr);
      }

!     if (svr->mutex) {
!       rv = apr_thread_mutex_unlock(svr->mutex);
!       if (rv != APR_SUCCESS) {
!           ap_log_perror(APLOG_MARK, APLOG_CRIT, rv, pool,
!                         "DBD: Failed to release thread mutex");
!           if (rv2 == APR_SUCCESS) {
!               rv2 = rv;
!           }
!       }
      }
      return rv2;
  }

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From nick@webthing.com  2006-12-11 02:59 -------
Ah, OK.  I think this is probably a side-effect of the fact that inheritance
between the main server config and <VirtualHost>s isn't working correctly.

Can you test-drive it with mod_dbd from /trunk/ ?  That would be useful.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From jens@strawberry.com  2006-12-11 06:03 -------
(In reply to comment #3)
> Ah, OK.  I think this is probably a side-effect of the fact that inheritance
> between the main server config and <VirtualHost>s isn't working correctly.
> 
> Can you test-drive it with mod_dbd from /trunk/ ?  That would be useful.


I may try that. Could you please point me to the trunk download page
or send the according files via mail to me? I had a look at the apache
home page but did not find any link to the development zone ... maybe
I'm too blind to see it ;-)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From jens@strawberry.com  2006-12-12 13:17 -------
Hi,

I've tried the patch from issue 39985 and the mod_dbd.c
trunk verion now. Both do not work.

The development tree and all information about how I built
and configured apache are on one of my public servers now.
There's also a compiler and debugger installed.

I may grant access to the server to you to have a look at
the situation ... if this would be an approach pls. contact
me personally by mail for the login data.

Jens

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141


nick@webthing.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From nick@webthing.com  2006-12-10 05:50 -------
dbd_setup_lock is only ever called if dbd_setup_init failed at server
initialisation.  That's basically so it can recover if the database was down at
apache startup time.

Can you explain how a problem arises for you?  Is it after the database has gone
down and been restarted?

BTW, there may be a bug, but your patch is definitely broken, as it's not
thread-safe.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From jens@strawberry.com  2006-12-10 23:45 -------
Hi,

psql authentication is working properly in apache 2.2.2.
Because of difficulties with php 5.2.0 - they finally boiled down
to another apache problem issue 41142 - I upgraded to version 2.2.3.

It turned out, that in version 2.2.3 apache was not able any more to
authenticate against the PostgreSQL database. Using a debugger I 
figured out, that

    dbd_setup_init did *not* fail. dbd_setup returns APR_SUCESS. This
        return value is returned by dbd_setup_init in the second if
        statement.

    Therefor srv->mutex was still NULL

    dbd_setup_lock was called afterwards. It failed because of srv->mutex.

The postgres database was setup when apache 2.2.2 was running. It was
not modified since then. After applying my patch, apache including the
authentication seemd ok for me again.

I had another look at the code right now. I turns out, that dbd_setup_lock
is called if svr->dbpool is NULL. However db_setup returns APR_SUCCESS,
thus apr_reslist_create obviously returns APR_SUCCESS. The later function
for my understanding should setup svr->dbpool. And it does so. 

So at the moment I'm stucked ... the only explanation would be some side
effect overriding svr->dbpool ...

Jens

    

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From nick@webthing.com  2007-09-10 04:36 -------
2.2.6 has some major mod_dbd fixes.  Does it fix this problem for you?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141





------- Additional Comments From rpluem@apache.org  2006-12-11 13:18 -------
As you only need to exchange the file mod_dbd.c 
http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/database/mod_dbd.c?view=co
should be of sufficient help. For more please have a look at the "Source
Repository Information" section of http://httpd.apache.org/dev/.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


DO NOT REPLY [Bug 41141] - mod_dbd, apr_dbd_pgsql: Error looking up ... in database mod_dbd, apr_dbd_pgsql: Error looking up ... in database

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41141>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41141


nick@webthing.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From nick@webthing.com  2008-02-18 00:52 -------
No response since Comment 7; assuming fixed.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org