apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: segfault in apr_atomic_cas
Date Thu, 25 Sep 2003 07:32:40 GMT
Stas Bekman wrote:
[...]
> I have a dirty workaround, setting global_pool->mutex to NULL, at least 
> I can do some debugging.

If anybody needs it to work now here is a dirty workaround that works for me. 
notice that it disables the mutex on the global pool, so you may have problems 
in the threaded environment.

Index: memory/unix/apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.197
diff -u -r1.197 apr_pools.c
--- memory/unix/apr_pools.c	18 Jul 2003 23:10:04 -0000	1.197
+++ memory/unix/apr_pools.c	25 Sep 2003 07:30:01 -0000
@@ -1505,8 +1505,14 @@
  {
      apr_pool_t *pool;

+    if (allocator == (apr_allocator_t *)0xdeadbeaf) {
+        allocator = NULL;
+        global_pool->mutex = NULL;
+
+    }
+
      *newpool = NULL;
-
+
      if (!parent) {
          parent = global_pool;
      }
Index: misc/unix/start.c
===================================================================
RCS file: /home/cvs/apr/misc/unix/start.c,v
retrieving revision 1.70
diff -u -r1.70 start.c
--- misc/unix/start.c	6 Jan 2003 23:44:32 -0000	1.70
+++ misc/unix/start.c	25 Sep 2003 07:30:01 -0000
@@ -93,6 +93,24 @@
      if ((status = apr_pool_initialize()) != APR_SUCCESS)
          return status;

+#if APR_POOL_DEBUG
+    {
+        apr_pool_t *pool = NULL;
+        apr_status_t rv;
+
+        if ((rv = apr_pool_create_ex(&pool, NULL, NULL,
+                                     (apr_allocator_t *)0xdeadbeaf)
+                ) != APR_SUCCESS) {
+            return rv;
+        }
+
+        if ((status = apr_atomic_init(pool)) != APR_SUCCESS) {
+            return status;
+        }
+    }
+#endif
+
+
      if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
          return APR_ENOPOOL;
      }
@@ -102,7 +120,7 @@
      if ((status = apr_atomic_init(pool)) != APR_SUCCESS) {
          return status;
      }
-
+
      apr_signal_init(pool);

      return APR_SUCCESS;

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Mime
View raw message