On Sun, May 05, 2002 at 03:36:18AM -0700, Justin Erenkrantz wrote: > With a threaded MPM of httpd-2.0, the userdata wouldn't have its > state stored properly (it'd always be NULL). Therefore, the > server would fail in odd ways later on. tsrm_startup() would > never be called and would segfault in php_post_read_request when > it tried to acquire the NULL mutex. > > This changes it from a setn call to a set call - it'll copy > the 1 and 2 into the hash's pool-allocated memory. The setn is > bogus because the storage space of the 1 and 2 aren't guaranteed > to be long-lived. (Look at how mod_rewrite does it.) -- justin
I see what's going on here now, and you almost had it right (although your patch was correct). It doesn't have to do with the MPM, nor does it have to do with the storage space of (void*)1 or (void*)2 not being long-lived. What's happening is during apache's load-unload-load cycle of the DSO, the static space is also lost. Here's what happens: 1) first load, setn(userdata_key1) 2) unload 3) second load, static strings like userdata_key are now likely relocated so the call to apr_pool_userdata_get() with a different pointer than the original setn() call finds no entry and return NULL. 4) we don't initialize because we never find the entry set to (void*)1. Thanks for pointing this out and thanks for the patch! :) -aaron -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php