Bug #66623 [Asn]: no EINTR check on flock(LOCK_EX)
| From: | yohgaki@php.net | Date: | Wed, 10 Dec 2014 22:49:06 +0000 |
| Subject: | Bug #66623 [Asn]: no EINTR check on flock(LOCK_EX) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188999@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66623&edit=1
ID: 66623
Updated by: yohgaki@php.net
Reported by: php at bof dot de
Summary: no EINTR check on flock(LOCK_EX)
Status: Assigned
Type: Bug
Package: Session related
PHP Version: 5.6.0alpha1
Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
I'll process my list of todos before PHP7, hopefully.
Previous Comments:
------------------------------------------------------------------------
[2014-10-17 13:59:18] tyrael@php.net
any update on this?
------------------------------------------------------------------------
[2014-02-01 22:28:12] yohgaki@php.net
Thank you for reporting.
------------------------------------------------------------------------
[2014-02-01 08:48:21] php at bof dot de
Description:
------------
Noticed a problem in ext/session/mod_files.c :
> Some syscalls can fail with EINTR, when a signal hits while within the
> kernel. This is especially true for flock(LOCK_EX) because in the
> already-locked case the second call will go to sleep for a while waiting
> for the lock to clear. But it is also possible, I think, for the
> pread/read/write calls. The usual handling for the case (-1 return &&
> errno
> == EINTR) is to just repeat the call in a while loop. I think that at
> least
> doing so for the LOCK_EX calls, would be prudent.
Re-Read the manpage (*) a bit... read/pread/write should be safe here, going
to disk, and not a pipe or socket. But flock() will return EINTR when
signalled and the signal handler did not use SA_RESTART. Most PHP execution
will _probably_ okay anyway as $restart_syscalls is default true for
pcntl_signal(), but handling would be safer anyway.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66623&edit=1