From:             jik at kamens dot brookline dot ma dot us
Operating system: Linux
PHP version:      5.1.1
PHP Bug Type:     IMAP related
Bug description:  php-imap doesn't trap USR2 when mailbox is locked

Description:
------------
The imap c-client has code in it to send a "kiss of death" SIGUSR2 to
another process that has a mailbox locked, to cause that process to give
up the lock if it no longer needs it.  Anything which uses c-client is
supposed to define a singla handler for SIGUSR2 to catch the signal and at
minimum ignore it if the client doesn't want to relinquish the lock.  If it
doesn't do this, then the SIGUSR2 causes the process to die, and then the
other process, which sent the signal, claims the lock.

It appears that PHP's imap support doesn't define a SIGUSR2 handler, which
means that if (a) imap_open is used to open a local file and (b) another
process on the same machine happens to use c-client to open the same file
at around the same time, the first process will die silently because of
the SIGUSR2.

To fix this, imap_open needs to define a SIGUSR2 handler to catch and
ignore the signal while it's got the mailbox locked.

Reproduce code:
---------------
Put this script in a file and run it with one argument, the name of a
non-empty local mailbox, twice at the same time, e.g. (from bash) "php
/tmp/imap_open.php /var/mail/jik & php /tmp/imap_open.php /var/mail/jik". 
It may not fail every time, but at least some of the times you do this,
okne of the two php processes will print an error and exit because of the
USR2 signal.



-- 
Edit bug report at http://bugs.php.net/?id=35894&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=35894&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=35894&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=35894&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=35894&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=35894&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=35894&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=35894&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=35894&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=35894&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=35894&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=35894&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=35894&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=35894&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=35894&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=35894&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=35894&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=35894&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=35894&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=35894&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=35894&r=mysqlcfg

Reply via email to