ID:               45731
 Updated by:       [EMAIL PROTECTED]
 Reported By:      dharmeshmaniar at rediffmail dot com
-Status:           Open
+Status:           Analyzed
 Bug Type:         Reproducible crash
 Operating System: CentOS 3.8
 PHP Version:      5.2.6


Previous Comments:
------------------------------------------------------------------------

[2008-08-07 11:44:00] [EMAIL PROTECTED]

The problem is currently not fixed (and is not easily fixable).

IMO environment variables should not be used in multithreaded PHP for
now, as the variables will be shared across all running scripts, which
may cause some weird behaviors. Furthermore, when a script terminates
it resets all variables set by putenv(), and as they are shared, they
are also reseted in other threads.

If you use them to pass envs to an external program, you may use
proc_open(). For other uses there are probably alternatives too. If
not, FastCGI works well.


------------------------------------------------------------------------

[2008-08-06 16:51:49] [EMAIL PROTECTED]

This is reproducible with ZTS enabled.

Reproduce code:

$ cat /var/www/putenv.php
<?php
putenv("foo=bar");
?>
$ ab -n 10000 -c 100 http://localhost/putenv.php


------------------------------------------------------------------------

[2008-08-06 10:51:26] dharmeshmaniar at rediffmail dot com

Description:
------------
When we use putenv in php5.2.6 it generates segmentation fault.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1390175328 (LWP 13275)]
0x009ec303 in strchr () from /lib/tls/libc.so.6

This do not happen every time. The behaviour is random.

We removed put_env from our code and everything is working properly.

No more Segmentation fault after removing putenv.

Note: We are not using any of the 3rd party apps:APC, eAccelerator,
Turck MMCache, ionCube loader, Xcache, Xdebug

Actual result:
--------------
Below is the dump for gdb trace:

[New Thread -1537033312 (LWP 13289)]
[Thread -1211847776 (LWP 13258) exited]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1390175328 (LWP 13275)]
0x009ec303 in strchr () from /lib/tls/libc.so.6
(gdb) where
#0  0x009ec303 in strchr () from /lib/tls/libc.so.6
#1  0x009ace17 in putenv () from /lib/tls/libc.so.6
#2  0x003e2440 in php_putenv_destructor (pe=0xa325bb9c) at
/usr/local/src/php-5.2.5/ext/standard/basic_functions.c:3861
#3  0x0049953c in zend_hash_destroy (ht=0xa35336cc) at
/usr/local/src/php-5.2.5/Zend/zend_hash.c:526
#4  0x003e2e0a in zm_deactivate_basic (type=1, module_number=9,
tsrm_ls=0xa39d1d28) at
/usr/local/src/php-5.2.5/ext/standard/basic_functions.c:4179
#5  0x004940ba in module_registry_cleanup (module=0x9392988,
tsrm_ls=0xa39d1d28) at /usr/local/src/php-5.2.5/Zend/zend_API.c:1968
#6  0x00499814 in zend_hash_apply (ht=0x601f80, apply_func=0x494098
<module_registry_cleanup>, tsrm_ls=0xa39d1d28)
    at /usr/local/src/php-5.2.5/Zend/zend_hash.c:673
#7  0x0048f753 in zend_deactivate_modules (tsrm_ls=0xa39d1d28) at
/usr/local/src/php-5.2.5/Zend/zend.c:838
#8  0x00451594 in php_request_shutdown (dummy=0x0) at
/usr/local/src/php-5.2.5/main/main.c:1459
#9  0x004ff862 in php_handler (r=0x95c86c0) at
/usr/local/src/php-5.2.5/sapi/apache2handler/sapi_apache2.c:471
#10 0x08085f92 in ap_run_handler ()
#11 0x0808635d in ap_invoke_handler ()
#12 0x0806feb5 in ap_process_request ()
#13 0x0806b96d in _start ()
#14 0x095c86c0 in ?? ()
#15 0x00000004 in ?? ()
#16 0x095c86c0 in ?? ()
#17 0x095c86c0 in ?? ()
#18 0x0954d150 in ?? ()
#19 0x0954d060 in ?? ()
#20 0x00000000 in ?? ()




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=45731&edit=1

Reply via email to