httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r885873 - in /httpd/mod_fcgid/trunk: CHANGES-FCGID modules/fcgid/fcgid_mutex_unix.c
Date Tue, 01 Dec 2009 19:14:20 GMT
Author: trawick
Date: Tue Dec  1 19:14:19 2009
New Revision: 885873

URL: http://svn.apache.org/viewvc?rev=885873&view=rev
Log:
Resolve fatal EDEADLK errors with threaded MPMs on Solaris.

This applies only to the httpd 2.0.x/2.2.x path.  httpd >= 2.3
users should have recent APR 1.4.x levels which use a different
default mutex mechanism.

Special case: httpd >= 2.3 with threaded MPM on Solaris < 10

APR 1.4 uses the old fcntl default for Solaris < 10, and the
httpd 2.3.x path in mod_fcgid doesn't bother adjusting the default
mutex mechanism for the fcgid mutexes, so the user would need to 
use the Mutex directive at least until APR can consider a better
default for older levels of Solaris.

Modified:
    httpd/mod_fcgid/trunk/CHANGES-FCGID
    httpd/mod_fcgid/trunk/modules/fcgid/fcgid_mutex_unix.c

Modified: httpd/mod_fcgid/trunk/CHANGES-FCGID
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/CHANGES-FCGID?rev=885873&r1=885872&r2=885873&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] (original)
+++ httpd/mod_fcgid/trunk/CHANGES-FCGID [utf8] Tue Dec  1 19:14:19 2009
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with mod_fcgid 2.3.5
 
+  *) Resolve fatal EDEADLK errors with threaded MPMs on Solaris.  [Jeff Trawick]
+
   *) Display information about active processes in the server-status page.
      [Ryan Pan]
 

Modified: httpd/mod_fcgid/trunk/modules/fcgid/fcgid_mutex_unix.c
URL: http://svn.apache.org/viewvc/httpd/mod_fcgid/trunk/modules/fcgid/fcgid_mutex_unix.c?rev=885873&r1=885872&r2=885873&view=diff
==============================================================================
--- httpd/mod_fcgid/trunk/modules/fcgid/fcgid_mutex_unix.c (original)
+++ httpd/mod_fcgid/trunk/modules/fcgid/fcgid_mutex_unix.c Tue Dec  1 19:14:19 2009
@@ -54,6 +54,8 @@
 
 #else
 
+#include "ap_mpm.h"
+
 #if AP_NEED_SET_MUTEX_PERMS
 #include "unixd.h"
 #endif
@@ -68,6 +70,30 @@
     return APR_SUCCESS;
 }
 
+static apr_lockmech_e pick_mutex_mechanism(void)
+{
+    apr_lockmech_e mechanism = APR_LOCK_DEFAULT;
+
+#if defined(SOLARIS2) && APR_USE_FCNTL_SERIALIZE
+    /* default is fcntl(), which isn't thread-aware on Solaris; fcgid will
+     * exit with EDEADLK errors if it is used with a threaded MPM
+     */
+    int threaded;
+    apr_status_t rv;
+
+    rv = ap_mpm_query(AP_MPMQ_IS_THREADED, &threaded);
+    if (rv == APR_SUCCESS && threaded) {
+#if APR_HAS_PROC_PTHREAD_SERIALIZE
+        mechanism = APR_LOCK_PROC_PTHREAD;
+#elif APR_HAS_SYSVSEM_SERIALIZE
+        mechanism = APR_LOCK_SYSVSEM;
+#endif
+    }
+#endif
+
+    return mechanism;
+}
+
 apr_status_t fcgid_mutex_create(apr_global_mutex_t **mutex,
                                 const char **lockfilep,
                                 const char *mutex_type,
@@ -75,7 +101,7 @@
                                 server_rec *s)
 {
     apr_status_t rv;
-    apr_lockmech_e mechanism = APR_LOCK_DEFAULT;
+    apr_lockmech_e mechanism = pick_mutex_mechanism();
     char *lockfile;
 
     lockfile = apr_palloc(pconf, L_tmpnam);



Mime
View raw message