[PATCH] Fix for bug 17414
| From: | Timo Teräs | Date: | Mon, 21 Jul 2003 12:08:08 +0000 |
| Subject: | [PATCH] Fix for bug 17414 | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-3541@lists.php.net to get a copy of this message | ||
Hi.
I've been doing some research on the bug 17414 (segfaults on restart
when using apache2filter).
It appears that the segfault results from bad(?) pthreads implementation.
The TSRM deletes and recreates the TSD key. And it seems to result
that the main thread will have the old TSD value instead of zero for
the newly recreated key. See attached patch that seems to work around
this problem. Atleast, it Works-For-Me(tm).
Cheers,
Timo
--
Timo Teräs
timo.teras@iki.fi
diff -ru php-4.3.3RC1/TSRM/TSRM.c php-4.3.3RC1-tt/TSRM/TSRM.c --- php-4.3.3RC1/TSRM/TSRM.c 2003-07-21 13:48:15.000000000 +0300 +++ php-4.3.3RC1-tt/TSRM/TSRM.c 2003-07-21 13:41:56.000000000 +0300 @@ -181,6 +181,7 @@ #if defined(GNUPTH) pth_kill(); #elif defined(PTHREADS) + pthread_setspecific(tls_key, 0); pthread_key_delete(tls_key); #elif defined(TSRM_WIN32) TlsFree(tls_key);
diff -ru php-4.3.3RC1/TSRM/TSRM.c php-4.3.3RC1-tt/TSRM/TSRM.c --- php-4.3.3RC1/TSRM/TSRM.c 2003-07-21 13:48:15.000000000 +0300 +++ php-4.3.3RC1-tt/TSRM/TSRM.c 2003-07-21 13:41:56.000000000 +0300 @@ -181,6 +181,7 @@ #if defined(GNUPTH) pth_kill(); #elif defined(PTHREADS) + pthread_setspecific(tls_key, 0); pthread_key_delete(tls_key); #elif defined(TSRM_WIN32) TlsFree(tls_key);