From: stanislav dot voroniy at portavita dot nl
Operating system: Linux
PHP version: 4.3.10
PHP Bug Type: Session related
Bug description: Session does not close file in /tmp/
Description:
------------
In my application running Apache 2.0.46/php 4.3.10 in some scripts after
complte execution file in /tmp/sess_xxxxx stays open. I've done tracing of
apache processes with strace and found the following:
process A do open /tmp/sess_ file, flock it, execute script, close
connection, but does not close /tmp/sess_ file. Any further request within
this session is haging - further processes try to flock /tmp/sess_ file
that stays open in process A and gets infinitive wait within the flock
syscall.
Reproduce code:
---------------
I can't reproduce it in separate script. But the same application under
Apache 1.3/PHP 4.3.4 works fine.
Expected result:
----------------
Sessions hangs.
Actual result:
--------------
Normal run of scripts:
14:40:58.514489 open("/tmp/sess_89b3f6140bce299259e0f810037c2d59",
O_RDWR|O_CREAT, 0600) = 29
14:40:58.514559 flock(29, LOCK_EX) = 0
14:40:58.514604 fcntl64(29, F_SETFD, FD_CLOEXEC) = 0
14:40:58.514646 fstat64(29, {st_mode=S_IFREG|0600, st_size=1976, ...}) =
0
14:40:58.514728 pread(29, "xxxxx"..., 1976, 0) = 1976
......
14:40:58.667724 ftruncate(29, 0) = 0
14:40:58.667807 pwrite(29, "xxxx"..., 1371, 0) = 1371
14:40:58.667923 close(29) = 0
Broken scripts:14:35:15.776816
open("/tmp/sess_89b3f6140bce299259e0f810037c2d59", O_RDWR|O_CREAT, 0600) =
29
14:35:15.776879 flock(29, LOCK_EX) = 0
14:35:15.776925 fcntl64(29, F_SETFD, FD_CLOEXEC) = 0
14:35:15.776966 fstat64(29, {st_mode=S_IFREG|0600, st_size=1976, ...}) =
0
14:35:15.777041 pread(29, "xxxxx" 1976, 0) = 1976
and no operation any more on file 29...
Next request within the same session:14:35:16.187099
open("/tmp/sess_89b3f6140bce299259e0f810037c2d59", O_RDWR|O_CREAT, 0600) =
29
14:35:16.187167 flock(29, LOCK_EX <unfinished ...>
In /proc/<pid>/fd/ of idle apache process after execution of "broken
scripts" I can see file 29 -> /tmp/sess_... still open.
--
Edit bug report at http://bugs.php.net/?id=32092&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32092&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32092&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32092&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32092&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32092&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32092&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32092&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32092&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32092&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32092&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32092&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32092&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32092&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32092&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32092&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32092&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32092&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32092&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32092&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32092&r=mysqlcfg