Edit report at https://bugs.php.net/bug.php?id=51382&edit=1
ID: 51382 Comment by: info at lategoodbye dot de Reported by: info at lategoodbye dot de Summary: session_start() blocks execution Status: Feedback Type: Bug Package: Session related Operating System: Linux 2.4.35.4 mips PHP Version: 5.3.2 Block user comment: N Private report: N New Comment: In 2010, i could isolate the problem by writing my own session handler. The hanging appeared after the second call of the PHP function readdir(). The problem with readdir() could also reproduced outside the session handler: Test script: <?php $dp = opendir("/tmp"); while (($file = readdir($dp)) !== FALSE) { echo $file."< br>"; } closedir($dp); ?> Luckily the hanging didn't appear by using the DirectoryIterator. As a workaround, i written my own session handler with the DirectoryIterator. Previous Comments: ------------------------------------------------------------------------ [2012-03-31 04:18:57] yohg...@php.net Do you still have this problem or resolved by yourself? ------------------------------------------------------------------------ [2010-05-04 10:55:46] info at lategoodbye dot de Looking at the strace, i can see that the garbage collector is invoked, after the current session is locked. Is it possible that the garbage collector hangs because of the locked session? ------------------------------------------------------------------------ [2010-03-31 16:29:40] info at lategoodbye dot de I'm sorry, i didn't get gdb running on the Asus Router (Flash too small). But i've a strace for you, may be it helps: accept(0, {sa_family=AF_FILE, NULL}, [2]) = 3 poll([{fd=3, events=POLLIN}], 1, 5000) = 1 ([{fd=3, revents=POLLIN}]) read(3, "\1\1\0\1\0\10\0\0", 8) = 8 read(3, "\0\1\0\0\0\0\0\0", 8) = 8 read(3, "\1\4\0\1\3H\0\0", 8) = 8 read(3, "\17\17SERVER_SOFTWARElighttpd/1.4.25"..., 840) = 840 read(3, "\1\4\0\1\0\0\0\0", 8) = 8 time(NULL) = 946686768 lstat("/www/pc/power.php", {st_mode=S_IFREG|0644, st_size=8269, ...}) = 0 lstat("/www/pc", {st_mode=0, st_size=97, ...}) = 0 lstat("/www", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 old_mmap(NULL, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, 0, 0) = 0x2afaa000 time(NULL) = 946686768 stat("/www/.user.ini", 0x7fff46e8) = -1 ENOENT (No such file or directory) stat("/www/pc/.user.ini", 0x7fff46e8) = -1 ENOENT (No such file or directory) setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={60, 0}}, NULL) = 0 rt_sigaction(SIGPROF, {0x10000000, [RT_68 RT_69 RT_76 RT_77 RT_79 RT_81 RT_82 RT_83 RT_84 RT_85 RT_86 RT_87 RT_88 RT_89 RT_90 RT_91 RT_92 RT_93 RT_94], SA_SIGINFO|0x66b990}, {SIG_DFL, [RT_65 RT_66], 0}, 16) = 0 rt_sigprocmask(SIG_UNBLOCK, [PROF], NULL, 16) = 0 time(NULL) = 946686768 open("/www/pc/power.php", O_RDONLY) = 4 ioctl(4, TIOCNXCL, 0x7fff5888) = -1 ENOTTY (Inappropriate ioctl for device) brk(0x956000) = 0x956000 fstat(4, {st_mode=S_IFREG|0644, st_size=2606, ...}) = 0 read(4, "<?php\n\nrequire_once(\"/www/power_"..., 4096) = 2606 _llseek(4, 0, [0], SEEK_SET) = 0 getcwd("", 4095) = 9 chdir("\35\2") = 0 setitimer(ITIMER_PROF, {it_interval={0, 0}, it_value={30, 0}}, NULL) = 0 ioctl(4, TIOCNXCL, 0x7fff3678) = -1 ENOTTY (Inappropriate ioctl for device) fstat(4, {st_mode=S_IFREG|0644, st_size=2606, ...}) = 0 old_mmap(NULL, 2638, PROT_READ, MAP_PRIVATE, 718909632, 0) = 0x2aaae000 _llseek(4, 0, [0], SEEK_SET) = 0 munmap(0x2aaae000, 2606) = 0 close(4) = 0 time(NULL) = 946686768 lstat("/www/power_logic.inc.php", {st_mode=S_IFREG|0644, st_size=2385, ...}) = 0 time(NULL) = 946686768 open("/www/power_logic.inc.php", O_RDONLY) = 4 fstat(4, {st_mode=S_IFCHR|S_ISUID|030000554, st_rdev=makedev(0, 0), ...}) = 0 fstat(4, {st_mode=05273160660, st_size=720167216, ...}) = 0 fstat(4, {st_mode=0, st_size=0, ...}) = 0 old_mmap(NULL, 2385, PROT_READ, MAP_SHARED, 4, 0) = 0x2aaae000 munmap(0x2aaae000, 2385) = 0 close(4) = 0 brk(0x957000) = 0x957000 time(NULL) = 946686768 lstat("/www/defines.inc.php", {st_mode=S_IFREG|0644, st_size=5087, ...}) = 0 time(NULL) = 946686768 open("/www/defines.inc.php", O_RDONLY) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=5087, ...}) = 0 fstat(4, {st_mode=0, st_size=0, ...}) = 0 fstat(4, {st_mode=S_IFREG|040000130, st_size=0, ...}) = 0 old_mmap(NULL, 5087, PROT_READ, MAP_SHARED, 4, 0) = 0x2aaae000 munmap(0x2aaae000, 5087) = 0 close(4) = 0 brk(0x958000) = 0x958000 brk(0x959000) = 0x959000 time(NULL) = 946686769 lstat("/www/functions.inc.php", {st_mode=S_IFREG|0644, st_size=8586, ...}) = 0 time(NULL) = 946686769 open("/www/functions.inc.php", O_RDONLY) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=8586, ...}) = 0 fstat(4, {st_mode=S_IFREG|0644, st_size=18, ...}) = 0 fstat(4, {st_mode=S_IFREG|040000130, st_size=4, ...}) = 0 old_mmap(NULL, 8586, PROT_READ, MAP_SHARED, 4, 0) = 0x2aaae000 brk(0x95a000) = 0x95a000 munmap(0x2aaae000, 8586) = 0 close(4) = 0 open("/tmp/sess_29fa4b85a40a392a7955de8cdc62d5f6", O_RDWR|O_CREAT, 0600) = 4 flock(4, LOCK_EX) = 0 fcntl(4, F_SETFD, FD_CLOEXEC) = 0 fstat(4, {st_mode=S_IFSOCK|S_ISGID|05273600020, st_size=19, ...}) = 0 lseek(4, 0, SEEK_SET) = 0 read(4, "authentication|b:1;", 19) = 19 gettimeofday({946686769, 156033}, NULL) = 0 getpid() = 789 gettimeofday({946686769, 156033}, NULL) = 0 open("/tmp", O_RDONLY|O_NONBLOCK|O_DIRECTORY) = 5 fstat(5, {st_mode=S_IFDIR|S_ISVTX|0777, st_size=360, ...}) = 0 fcntl(5, F_SETFD, FD_CLOEXEC) = 0 brk(0x95b000) = 0x95b000 time([946686769]) = 946686769 getdents64(5, /* 18 entries */, 4096) = 560 rt_sigprocmask(SIG_SETMASK, NULL, [RT_0], 16) = 0 rt_sigsuspend([] ------------------------------------------------------------------------ [2010-03-25 17:59:52] abca_b_cabcom at hotmail dot com Maybe you can post your backtrace result here first, i just guess it is a compiler error, cause php_combined_lcg function should have no error. ------------------------------------------------------------------------ [2010-03-25 15:11:53] info at lategoodbye dot de May be i expressed myself bad about the option session.gc_divisor. Setting the option to 100000 is nearly like disabling garbage collection. The chance to reproduce the problem is very, very low but possible. How can i findout that it's a compile error? Nevertheless i will make the backtrace. ------------------------------------------------------------------------ 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 https://bugs.php.net/bug.php?id=51382 -- Edit this bug report at https://bugs.php.net/bug.php?id=51382&edit=1