php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10675 Executing background job from PHP causes session lock-up
Submitted: 2001-05-04 15:22 UTC Modified: 2001-05-05 14:21 UTC
From: millz at incogen dot com Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.5 OS: RedHat 6.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: millz at incogen dot com
New email:
PHP Version: OS:

 

 [2001-05-04 15:22 UTC] millz at incogen dot com
Executed a perl script in the background like this:
perl scriptname.pl $otherParams 2> /dev/null 1> /dev/null

Perl script forks and parent dies, so PHP "should" see the script as finished immediately, perl child does work in background (takes a few minutes to run).

PHP script that spawned perl script completes OK, browser stops waiting for more data from php script as it should.

However, when using the same browser window (or one from browser's file->new window) no other pages that referrence the session will load in the browser.  If we force the session to destroy just after the system() call, other scripts load just fine.  Also, other scripts work just fine if we start a new browser from scratch (creates new session).

So it appears that the PHP session is getting messed up somehow b/c of the background system/exec/`` call.  This seems to prevent the following pages from loading the session properly and therefore they will not run.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-04 15:54 UTC] millz at incogen dot com
Executed a perl script in the background like this:
perl scriptname.pl $otherParams 2> /dev/null 1> /dev/null

Perl script forks and parent dies, so PHP "should" see the script as finished
immediately, perl child does work in background (takes a few minutes to run).

PHP script that spawned perl script completes OK, browser stops waiting for more data from
php script as it should.

However, when using the same browser window (or one from browser's file->new window) no
other pages that referrence the session will load in the browser.  If we force the session
to destroy just after the system() call, other scripts load just fine.  Also, other
scripts work just fine if we start a new browser from scratch (creates new session).

So it appears that the PHP session is getting messed up somehow b/c of the background
system/exec/`` call.  This seems to prevent the following pages from loading the session
properly and therefore they will not run.


One other thing, once the child perl script is finally complete everything starts working again, i.e.-the session is OK again.  
 [2001-05-05 14:16 UTC] sas@php.net
Your perl scripts inherits the open file descriptors and hence also the open fd for the session file. And hence, the lock associated with the fd is not automatically released, when PHP closes the fd.

You might want to close all fds upon startup of the perl script to prevent this scenario. 
 [2001-05-05 14:21 UTC] sas@php.net
Your perl scripts inherits the open file descriptors and hence also the open fd for the session file. And hence, the lock associated with the fd is not automatically released, when PHP closes the fd.

You might want to close all fds upon startup of the perl script to prevent this scenario. 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 27 04:01:27 2024 UTC