New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout action: SessionHandler::write(): Parent session handler is not open #5868

Closed
ghost opened this Issue Oct 29, 2012 · 34 comments

Comments

Projects
None yet
@ghost

ghost commented Oct 29, 2012

Working through some tests using the bundled Security functionality, and we have noticed that on a logout action we are getting in our server logs:

[Mon Oct 29 16:43:14 2012] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error:  Uncaught exception 'ErrorException' with message 'Warning: SessionHandler::write(): Parent session handler is not open in /web_dir/app/cache/dev/classes.php line 558' in /web_dir/app/cache/dev/classes.php:558\nStack trace:\n#0 [internal function]: Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler->handle(2, 'SessionHandler:...', '/web_dir...', 558, Array)\n#1 /web_dir/app/cache/dev/classes.php(558): SessionHandler->write('e0ua5bnj0vneq97...', '_sf2_attributes...')\n#2 [internal function]: Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy->write('e0ua5bnj0vneq97...', '_sf2_attributes...')\n#3 [internal function]: session_write_close()\n#4 {main}\n  thrown in /web_dir/app/cache/dev/classes.php on line 558

It seems this issue isn't unique to us as seen at:

https://groups.google.com/forum/?fromgroups=#!topic/symfony-devs/Q-f0lKT7OZ8

We are running a centos 6 machine running PHP v5.4.7 and Apache/2.2.15.

Anyone have any suggestions as to what is causing this and how we can eliminate this message on every log out?

@davedevelopment

This comment has been minimized.

Show comment
Hide comment
@davedevelopment

davedevelopment Nov 2, 2012

Contributor

I ran in to this, probably related to this https://bugs.php.net/bug.php?id=63379

Contributor

davedevelopment commented Nov 2, 2012

I ran in to this, probably related to this https://bugs.php.net/bug.php?id=63379

@marcosgdf

This comment has been minimized.

Show comment
Hide comment
@marcosgdf

marcosgdf Nov 12, 2012

Running PHP 5.4.4 under Mac OS X Mountain Lion

Fatal error: Uncaught exception 'ErrorException' with message 'Warning: SessionHandler::write(): Parent session handler is not open in /app/cache/dev/classes.php line 6318' in /app/cache/dev/classes.php:6318
Stack trace: 
#0 [internal function]: Symfony\Component\HttpKernel\Debug\ErrorHandler->handle(2, 'SessionHandler:...', '/Users/marcos/d...', 6318, Array) 
#1 /app/cache/dev/classes.php(6318): SessionHandler->write('e290059787e3be7...', '_sf2_attributes...') 
#2 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->write('e290059787e3be7...', '_sf2_attributes...') 
#3 [internal function]: session_write_close() #4 {main} thrown in /app/cache/dev/classes.php on line 6318

marcosgdf commented Nov 12, 2012

Running PHP 5.4.4 under Mac OS X Mountain Lion

Fatal error: Uncaught exception 'ErrorException' with message 'Warning: SessionHandler::write(): Parent session handler is not open in /app/cache/dev/classes.php line 6318' in /app/cache/dev/classes.php:6318
Stack trace: 
#0 [internal function]: Symfony\Component\HttpKernel\Debug\ErrorHandler->handle(2, 'SessionHandler:...', '/Users/marcos/d...', 6318, Array) 
#1 /app/cache/dev/classes.php(6318): SessionHandler->write('e290059787e3be7...', '_sf2_attributes...') 
#2 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->write('e290059787e3be7...', '_sf2_attributes...') 
#3 [internal function]: session_write_close() #4 {main} thrown in /app/cache/dev/classes.php on line 6318
@tecbot

This comment has been minimized.

Show comment
Hide comment
@tecbot

tecbot Nov 13, 2012

Contributor

same here.. debian

Contributor

tecbot commented Nov 13, 2012

same here.. debian

@makasim

This comment has been minimized.

Show comment
Hide comment
@makasim

makasim Nov 14, 2012

Contributor

had this error in mail email too. Debian server.

Subject
        ErrorException: SessionHandler::close(): Parent session handler is not open
Summary
        Class: ErrorException
        Uri: http://foo.com/logout
        Code: E_WARNING
        Message: SessionHandler::close(): Parent session handler is not open
        File: /home/foo/www/releases/20121113194702/app/cache/prod/classes.php, Line: 546

Stacktrace
        exception 'ErrorException' with message 'SessionHandler::close(): Parent session handler is not open' in /home/foo/www/releases/20121113194702/app/cache/prod/classes.php:546
        Stack trace:
        #0 [internal function]: UniversalErrorCatcher_Catcher->handleError(2, 'SessionHandler:...', '/home/foo/w...', 546, Array)
        #1 /home/foo/www/releases/20121113194702/app/cache/prod/classes.php(546): SessionHandler->close()
        #2 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->close()
        #3 [internal function]: session_write_close()
        #4 {main}
Contributor

makasim commented Nov 14, 2012

had this error in mail email too. Debian server.

Subject
        ErrorException: SessionHandler::close(): Parent session handler is not open
Summary
        Class: ErrorException
        Uri: http://foo.com/logout
        Code: E_WARNING
        Message: SessionHandler::close(): Parent session handler is not open
        File: /home/foo/www/releases/20121113194702/app/cache/prod/classes.php, Line: 546

Stacktrace
        exception 'ErrorException' with message 'SessionHandler::close(): Parent session handler is not open' in /home/foo/www/releases/20121113194702/app/cache/prod/classes.php:546
        Stack trace:
        #0 [internal function]: UniversalErrorCatcher_Catcher->handleError(2, 'SessionHandler:...', '/home/foo/w...', 546, Array)
        #1 /home/foo/www/releases/20121113194702/app/cache/prod/classes.php(546): SessionHandler->close()
        #2 [internal function]: Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy->close()
        #3 [internal function]: session_write_close()
        #4 {main}
@dfinkler

This comment has been minimized.

Show comment
Hide comment
@dfinkler

dfinkler Dec 5, 2012

i am seeing this too.. ubuntu / php 5.4.9

dfinkler commented Dec 5, 2012

i am seeing this too.. ubuntu / php 5.4.9

@ruudk

This comment has been minimized.

Show comment
Hide comment
@ruudk

ruudk Dec 6, 2012

Contributor

Same here: Cent OS / PHP 5.4.9

Contributor

ruudk commented Dec 6, 2012

Same here: Cent OS / PHP 5.4.9

@smottt

This comment has been minimized.

Show comment
Hide comment
@smottt

smottt Dec 17, 2012

Same. Ubuntu / 5.4.9

smottt commented Dec 17, 2012

Same. Ubuntu / 5.4.9

@crevillo

This comment has been minimized.

Show comment
Hide comment
@crevillo

crevillo Dec 21, 2012

same, ubuntu / 5.4.9

crevillo commented Dec 21, 2012

same, ubuntu / 5.4.9

@mvrhov

This comment has been minimized.

Show comment
Hide comment
@mvrhov

mvrhov Dec 22, 2012

Contributor

ping @Drak

Contributor

mvrhov commented Dec 22, 2012

ping @Drak

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Dec 24, 2012

UPDATE: This issue has been fixed in PHP so I'm assuming it will make it to the next releases of PHP 5.4.11 and PHP 5.3.21.

ghost commented Dec 24, 2012

UPDATE: This issue has been fixed in PHP so I'm assuming it will make it to the next releases of PHP 5.4.11 and PHP 5.3.21.

@tyx

This comment has been minimized.

Show comment
Hide comment
@tyx

tyx Jan 25, 2013

Contributor

Hi,

Anyone can confirm this bug is fixed with updating on PHP 5.4.11 ?

Thanks

Contributor

tyx commented Jan 25, 2013

Hi,

Anyone can confirm this bug is fixed with updating on PHP 5.4.11 ?

Thanks

@tyx

This comment has been minimized.

Show comment
Hide comment
@tyx

tyx Jan 29, 2013

Contributor

So I confirm it is fixed with 5.4.11 ;)

Contributor

tyx commented Jan 29, 2013

So I confirm it is fixed with 5.4.11 ;)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jan 30, 2013

And I guess it will also be fixed then with the latest 5.3.21 - it should be.

ghost commented Jan 30, 2013

And I guess it will also be fixed then with the latest 5.3.21 - it should be.

@xr09

This comment has been minimized.

Show comment
Hide comment
@xr09

xr09 commented Apr 29, 2013

Here is a temporal fix for anyone without the possibility to upgrade PHP.

https://groups.google.com/group/symfony-devs/browse_thread/thread/43e7f494a4fb399f/ab041c9f85d7eb9e?lnk=raot&pli=1

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Apr 29, 2013

Ticket should be closed. There is nothing more we can do and the problem is fixed in PHP.

ghost commented Apr 29, 2013

Ticket should be closed. There is nothing more we can do and the problem is fixed in PHP.

@Tobion Tobion closed this Apr 29, 2013

@saem

This comment has been minimized.

Show comment
Hide comment
@saem

saem Jun 7, 2013

Contributor

This should not be closed. It is clear that it doesn't work in PHP 5.4.x, where x is at the very least lower than 11.

The check should be changed such that it checks against the minor revision number and fall back to the old method, rather than being broken for a number of PHP 5.4.x. versions.

Contributor

saem commented Jun 7, 2013

This should not be closed. It is clear that it doesn't work in PHP 5.4.x, where x is at the very least lower than 11.

The check should be changed such that it checks against the minor revision number and fall back to the old method, rather than being broken for a number of PHP 5.4.x. versions.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jun 8, 2013

There really is nothing that can be done, it's a pretty serious bug in PHP 5.4 less than 5.4.11. The bug does not exist in PHP 5.3

ghost commented Jun 8, 2013

There really is nothing that can be done, it's a pretty serious bug in PHP 5.4 less than 5.4.11. The bug does not exist in PHP 5.3

@saem

This comment has been minimized.

Show comment
Hide comment
@saem

saem Jun 8, 2013

Contributor

It's simply a warning, which gets converted to an Exception, IIRC. Why can't a range check be done, then supplement an implementation that catches the exception, checks the message/code, if it matches, suppress, otherwise rethrow?

Being unusable for the current version in Ubuntu 12.10, and a number of other distributions seems far worse than some cruft to work around this.

Contributor

saem commented Jun 8, 2013

It's simply a warning, which gets converted to an Exception, IIRC. Why can't a range check be done, then supplement an implementation that catches the exception, checks the message/code, if it matches, suppress, otherwise rethrow?

Being unusable for the current version in Ubuntu 12.10, and a number of other distributions seems far worse than some cruft to work around this.

@Nercury

This comment has been minimized.

Show comment
Hide comment
@Nercury

Nercury Jun 25, 2013

Contributor

So basically you suggest every developer to go code their own fallback solutions in their own forked symfony repo instead of fixing it in the same place? "Nothing can be done" does not work for some of us, and we will have to write some nasty code ourselves.

Contributor

Nercury commented Jun 25, 2013

So basically you suggest every developer to go code their own fallback solutions in their own forked symfony repo instead of fixing it in the same place? "Nothing can be done" does not work for some of us, and we will have to write some nasty code ourselves.

@rKow

This comment has been minimized.

Show comment
Hide comment
@rKow

rKow Jul 10, 2013

There is a simple solution, look here: http://ferdinandfly.blogspot.com/2013/06/symfony2-php-warning.html
"the solution for no way to upgrade php is" :
// in security.yml
logout:
...
invalidate_session: false

But it should be only temporary solution.

rKow commented Jul 10, 2013

There is a simple solution, look here: http://ferdinandfly.blogspot.com/2013/06/symfony2-php-warning.html
"the solution for no way to upgrade php is" :
// in security.yml
logout:
...
invalidate_session: false

But it should be only temporary solution.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 10, 2013

I'd also like to put the problem is perspective just for clarity. The issue only exists for less than PHP 5.4.11. PHP 5.4 accounts for 3.6% of the entire PHP eco system, and versions less than 5.4.11 account for 40% of PHP 5.4 websites and just 1.04% of all PHP websites. 3% of websites are using PHP 4 so while it's a problem, it's not huge and there is a temporary solution until you can upgrade to PHP 5.4.11 or above.

Source: http://w3techs.com/technologies/details/pl-php/5.4/all and looking at the historical trends.

ghost commented Jul 10, 2013

I'd also like to put the problem is perspective just for clarity. The issue only exists for less than PHP 5.4.11. PHP 5.4 accounts for 3.6% of the entire PHP eco system, and versions less than 5.4.11 account for 40% of PHP 5.4 websites and just 1.04% of all PHP websites. 3% of websites are using PHP 4 so while it's a problem, it's not huge and there is a temporary solution until you can upgrade to PHP 5.4.11 or above.

Source: http://w3techs.com/technologies/details/pl-php/5.4/all and looking at the historical trends.

@fabpot

This comment has been minimized.

Show comment
Hide comment
@fabpot

fabpot Jul 10, 2013

Member

Reopening this ticket as we should add a check in the Distribution bundle to warn people about this problem as so many developers hit this issue in the past.

Member

fabpot commented Jul 10, 2013

Reopening this ticket as we should add a check in the Distribution bundle to warn people about this problem as so many developers hit this issue in the past.

@fabpot fabpot reopened this Jul 10, 2013

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 10, 2013

It might be good to reference the workaround in the documentation as well.

ghost commented Jul 10, 2013

It might be good to reference the workaround in the documentation as well.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost commented Jul 18, 2013

+1

@ironbone

This comment has been minimized.

Show comment
Hide comment
@ironbone

ironbone Jul 22, 2013

I confirm this problem (only in dev enviroment) in OpenSuse, PHP 5.3.17 (cli)

ironbone commented Jul 22, 2013

I confirm this problem (only in dev enviroment) in OpenSuse, PHP 5.3.17 (cli)

@azatyan

This comment has been minimized.

Show comment
Hide comment
@azatyan

azatyan Jul 22, 2013

Contributor

Ubuntu, PHP 5.4.9 - problem found

Contributor

azatyan commented Jul 22, 2013

Ubuntu, PHP 5.4.9 - problem found

fabpot added a commit to sensiolabs/SensioDistributionBundle that referenced this issue Jul 23, 2013

fabpot added a commit to sensiolabs/SensioDistributionBundle that referenced this issue Jul 23, 2013

Merge branch '2.2'
* 2.2:
  added a new recommandation for a PHP bug (see symfony/symfony#5868)
@fabpot

This comment has been minimized.

Show comment
Hide comment
@fabpot

fabpot Jul 23, 2013

Member

Closing now as I have added a recommandation in the distribution bundle. see sensiolabs/SensioDistributionBundle@2a518e7

Member

fabpot commented Jul 23, 2013

Closing now as I have added a recommandation in the distribution bundle. see sensiolabs/SensioDistributionBundle@2a518e7

@ibtihelfekih

This comment has been minimized.

Show comment
Hide comment
@ibtihelfekih

ibtihelfekih Jul 30, 2013

I resolved the problem of logout with adding invalidate_session : false
Maybe one of you need it :)
firewalls:

    main:
        pattern: ^/
        logout:     
            path: /logout
            target: /
            invalidate_session: false

ibtihelfekih commented Jul 30, 2013

I resolved the problem of logout with adding invalidate_session : false
Maybe one of you need it :)
firewalls:

    main:
        pattern: ^/
        logout:     
            path: /logout
            target: /
            invalidate_session: false
@stof

This comment has been minimized.

Show comment
Hide comment
@stof

stof Aug 7, 2013

Member

@AlmogBaku The discussion above is telling that the bug is fixed in PHP 5.4.11. 5.4.9 is an older version, so a buggy one

Member

stof commented Aug 7, 2013

@AlmogBaku The discussion above is telling that the bug is fixed in PHP 5.4.11. 5.4.9 is an older version, so a buggy one

@reecefowell

This comment has been minimized.

Show comment
Hide comment
@reecefowell

reecefowell Jan 21, 2014

Contributor

What version of Symfony is this regarding?

I just upgraded to Symfony 2.4 today and bam, i get hit with this, was fine on 2.1/2.2/2.3. And i never changed/updated my PHP version, it was the same all along (PHP 5.5.7).

So i am a little confused, as this topic seems quite old now. Was this first introduced in 2.4 or earlier? And If earlier, how come i am only just experiencing this now on 2.4 and with a version of PHP exceeding 5.4.9 which claims fixes the issue? (as prior mentioned i am on PHP 5.5.7).

Anyone can enlighten me here please?

Basically:

  1. Which version of symfony was this bug introduced? i know which version of php, just need to know symfony version. (only just showing up for me on 2.4).
  2. Which version of PHP closes the bug? As i am on 5.5.7, or is this ongoing? Otherwise why am i only experiencing this now?
  3. Is this issue resolved with Symfony? If so what am i doing wrong?

Thanks!

Contributor

reecefowell commented Jan 21, 2014

What version of Symfony is this regarding?

I just upgraded to Symfony 2.4 today and bam, i get hit with this, was fine on 2.1/2.2/2.3. And i never changed/updated my PHP version, it was the same all along (PHP 5.5.7).

So i am a little confused, as this topic seems quite old now. Was this first introduced in 2.4 or earlier? And If earlier, how come i am only just experiencing this now on 2.4 and with a version of PHP exceeding 5.4.9 which claims fixes the issue? (as prior mentioned i am on PHP 5.5.7).

Anyone can enlighten me here please?

Basically:

  1. Which version of symfony was this bug introduced? i know which version of php, just need to know symfony version. (only just showing up for me on 2.4).
  2. Which version of PHP closes the bug? As i am on 5.5.7, or is this ongoing? Otherwise why am i only experiencing this now?
  3. Is this issue resolved with Symfony? If so what am i doing wrong?

Thanks!

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jan 21, 2014

  1. Which version of symfony was this bug introduced?
    => 2.2
  2. Which version of PHP closes the bug? As i am on 5.5.7, or is this ongoing? Otherwise why am i only experiencing this now?
    PHP > 5.4.11
  3. Is this issue resolved with Symfony? If so what am i doing wrong?
    This is not a bug related to symfony, but related to php.
    The workaround was to add a recommandation in the distribution bundle (sensiolabs/SensioDistributionBundle@2a518e7)

ghost commented Jan 21, 2014

  1. Which version of symfony was this bug introduced?
    => 2.2
  2. Which version of PHP closes the bug? As i am on 5.5.7, or is this ongoing? Otherwise why am i only experiencing this now?
    PHP > 5.4.11
  3. Is this issue resolved with Symfony? If so what am i doing wrong?
    This is not a bug related to symfony, but related to php.
    The workaround was to add a recommandation in the distribution bundle (sensiolabs/SensioDistributionBundle@2a518e7)
@reecefowell

This comment has been minimized.

Show comment
Hide comment
@reecefowell

reecefowell Jan 21, 2014

Contributor

Hmmm thats weird then.

As i have SF2.4 including all the standard deps that ship with 2.4, and a PHP version exceeding the minimum (by quite a bit), also, SensioDistributionBundle is up to date.

I trashed my cache and rebuilt it, but no joy.

Also, I have added the config invalidate_session: false, but still the problem persists.

What could it be?

I have a Sandbox ready to go with Vagrant+Puppet via Puphpet if anyone knows how to solve this and can duplicate the error. Appreciate any help i can get. Thanks.

Contributor

reecefowell commented Jan 21, 2014

Hmmm thats weird then.

As i have SF2.4 including all the standard deps that ship with 2.4, and a PHP version exceeding the minimum (by quite a bit), also, SensioDistributionBundle is up to date.

I trashed my cache and rebuilt it, but no joy.

Also, I have added the config invalidate_session: false, but still the problem persists.

What could it be?

I have a Sandbox ready to go with Vagrant+Puppet via Puphpet if anyone knows how to solve this and can duplicate the error. Appreciate any help i can get. Thanks.

@reecefowell

This comment has been minimized.

Show comment
Hide comment
@reecefowell

reecefowell Jan 22, 2014

Contributor

I solved the problem, and wrote about it here

Contributor

reecefowell commented Jan 22, 2014

I solved the problem, and wrote about it here

sjimenez77 added a commit to sjimenez77/iContraincendios that referenced this issue Feb 4, 2014

Mejoras Logout
- El error ContextErrorException aparece. REVISAR VERSIÓN PHP. Más info
en symfony/symfony#5868 (comment)
@diegosainz

This comment has been minimized.

Show comment
Hide comment
@diegosainz

diegosainz Jul 1, 2014

@reecefowell the problem you describe in your blog is regarding SessionHandler::read() when trying to read the session from the configured localtion and not the issue described here that is about a PHP bug triggered with SessionHandler::write().

diegosainz commented Jul 1, 2014

@reecefowell the problem you describe in your blog is regarding SessionHandler::read() when trying to read the session from the configured localtion and not the issue described here that is about a PHP bug triggered with SessionHandler::write().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment