#21306 [Fbk->Opn]: partly RSHUTDOWN and "cannot change the session settings" error

From: Date: Mon, 19 Sep 2005 15:16:52 +0000
Subject: #21306 [Fbk->Opn]: partly RSHUTDOWN and "cannot change the session settings" error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-85241@lists.php.net to get a copy of this message
 ID:               21306
 User updated by:  Xuefer at 21cn dot com
-Summary:          [PATCH] warning about "cannot change the session
                   settings"
 Reported By:      Xuefer at 21cn dot com
-Status:           Feedback
+Status:           Open
 Bug Type:         Session related
 Operating System: linux
 PHP Version:      4CVS (2005-09-16) (5CVS, 6CVS)
 Assigned To:      sas
 New Comment:

the fix is quite simple, just put a zend_try to protect it
in session module around retval = ps_call_handler(..), or
in Zend/zend_API.c module_registry_cleanup() around
module->request_shutdown_func(..)

> How common is it to run a PHP script like that?
> In a normal usage, I still can not reproduce this.
do u mean u can't reproduce for my test script or can't in normal
usage?
strange, "Reproduced: 36 of 37 (97.3%)" so far

the error message (not key point) is just what can be seen, which mean
the RSHUTDOWN is not completed (key point)

if u emphasize "normal usage", yes, no one want to "exit" in session
write handler, but anything else that lead to "zend_bailout" will get
me same effect. such as: $this->not_existing_method() ;;; mysql_*() or
exit() (something like lost connection close by server, not sql
statement error) ;;; a execution timeout ;; maybe exception? if it use
bailout, etc...
i agree, they're just bugs. but, ppl use session write handler mostly
for database storage, using a db class api -> more code -> more chance
to hit a script bug -> php bailout

* some module (mostly a opcode cacher) might rely on the RSHUTDOWN to
unlock()/refcount-- something
a simple bug in the script from the 3rd party might make php locked

do u thnk the reason above is enough?
any more i can help?


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

[2005-09-19 13:23:37] sniper@php.net

How common is it to run a PHP script like that?
In a normal usage, I still can not reproduce this.
Please explain how this is reproducable?


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

[2005-09-19 12:56:01] Xuefer at 21cn dot com

verified with php6
Zend/zend_API.c

#if 1 <- enable it
        zend_printf("%s:  Request shutdown\n", module->name);
#endif

#### ./sapi/cgi/php ./test.php

Content-type: text/html
Set-Cookie: SID=15db16deadc51c47e8878eaec63d5b71; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

libxml:  Request shutdown
xcache:  Request shutdown
tokenizer:  Request shutdown
standard:  Request shutdown
SPL:  Request shutdown
PDO:  Request shutdown
session:  Request shutdown

Warning: Unknown: A session is active. You cannot change the session
module's ini settings at this time. in Unknown on line 0
Unknown(0) : Warning - Unknown: A session is active. You cannot change
the session module's ini settings at this time.

#### echo '<?php echo "1\n";' | ./sapi/cgi/php 
Content-type: text/html

1
libxml:  Request shutdown
xcache:  Request shutdown
tokenizer:  Request shutdown
standard:  Request shutdown
SPL:  Request shutdown
PDO:  Request shutdown
session:  Request shutdown
sockets:  Request shutdown
sk:  Request shutdown
SQLite:  Request shutdown
pcntl:  Request shutdown
mysqli:  Request shutdown
mysql:  Request shutdown
memcache:  Request shutdown
event:  Request shutdown
date:  Request shutdown
bcmath:  Request shutdown

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

[2005-09-16 15:48:20] sniper@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

And provide a script that actually is usable. For that script it's
perfectly fine to give an error.. 
Also: The version string in the 'Version' field in the bug reports MUST
start with a number 4,5 or 6.

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

[2005-09-14 08:32:02] Xuefer at 21cn dot com

i have verified it in lastest cvs in 4.4 branch.


./sapi/cgi/php -c /home/xuefer/etc/php.ini test.php 
Content-type: text/html
X-Powered-By: PHP/4.4.1-dev
Set-Cookie: PHPSESSID=b50128d8959939728d21dd36eaf15b7c; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0
Pragma: no-cache

<br />
<b>Warning</b>:  Unknown(): A session is active. You cannot change the
session module's ini settings at this time. in <b>Unknown</b> on line
<b>0</b><br />

php.ini:
include_path=".:/usr/local/lib/php"
display_errors=On
error_reporting=E_ALL
log_errors = On
error_log = /tmp/phperr
memory_limit = 50M
(no other options)

reproduce script:
<?php
function dummy() {
    return '';
}
function test() {
    exit;
}

$open = $close = $read = $destroy = $gc = 'dummy';
$write = 'test';
session_set_save_handler($open, $close, $read, $write, $destroy, $gc);
session_start();
?>

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

[2005-09-02 08:44:21] sniper@php.net

Can not reproduce, there's been couple of reports and none them with
proper way to get this reproduced. Most likely user error.

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/21306

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


Thread (43 messages)

« previous php.bugs (#85241) next »