php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24161 imap_open will not timeout
Submitted: 2003-06-12 16:30 UTC Modified: 2003-06-26 09:26 UTC
From: thomas at xenocast dot com Assigned: iliaa (profile)
Status: Closed Package: IMAP related
PHP Version: 4.3.2 OS: Windows 2000
Private report: No CVE-ID: None
 [2003-06-12 16:30 UTC] thomas at xenocast dot com
Description:
------------
This is a difficult situation to reproduce. I will try 
to give you the history.  We are running iMail 7.x and 
the back-end is through an SQL server.  there is a bug 
in iMail that if the SQL Server for any reason is 
'lost' then POP3 will just hang and not attempt to 
reconnect. The only way around it is to restart the 
service.   This doesn't happen often on our system and 
it's quite random, but when it happens nobody can get 
their e-mail. The solution I came up with is a script 
(referenced below) to check on if I can login to POP3.  
If I cannot, restart the service.

The problem arises when this situation happens with 
iMail, the imap_open command simply hangs there. It is 
waiting for a response from the server after giving the 
username and/or password. and nothing comes. It hangs 
just like the e-mail clients do, howevver imap_open 
FAILS to timeout.  At last count the longest the script 
hung there without going anywhere was 30 minutes. and I 
do not even have set a script time-out so in the least 
the script should have failed itself due to running too 
long.  the function is just sitting there waiting for a 
response from the server.

Perhaps there's another way to do this or perhaps there 
is a bug in imap_open that doesn't provide for the 
thing to timeout or something, wdyt?

Reproduce code:
---------------
$mbox = imap_open("{mail.neweve.com:110/pop3/notls}INBOX", "thomas", "theduke"); 

if (!$mbox) {
	system("net stop pop3d32");
	system("net start pop3d32");	
}

Expected result:
----------------
Expected is that imap_open would fail with a timeout or 
something and $mbox would be false so my system would 
restart.

Actual result:
--------------
Actual result is that imap_open sits there and does 
nothing it never stops the script just hangs 
indefinitely.  When adding "echo" statements as debug 
code I see it never passes that line.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-12 16:35 UTC] thomas at xenocast dot com
Damn, umn.. I had trouble with the submission form and 
some funky thing with my browser. I didn't change the 
values of the user/pass and domain in my script. Now 
how many people got it?!  Well, I changed my password. 
please don't hack me.
 [2003-06-12 16:39 UTC] derick@php.net
About 500 ppl, but I doubt they saw it before you changed it.
 [2003-06-12 17:50 UTC] iliaa@php.net
assigning to self.
 [2003-06-13 07:47 UTC] sniper@php.net
Then assign it for real, Ilia. :)

 [2003-06-13 08:05 UTC] sniper@php.net
For Ilia: 
Maybe we should try introducing 'imap_parameters()' function. 
(wrapper for mail_parameters()). And allow people set those low-level parameters in the script.

 [2003-06-13 08:30 UTC] kalowsky@php.net
Wrapping mail_parameters was something on the list of 
TODO.  I had spoken with Chuck a long time ago about 
this, but there were some issues in implementing.  
Unfortunately I can't remember what.... just be aware 
it's not as easy as it first seems.
 [2003-06-13 08:35 UTC] iliaa@php.net
With a noteable exception of timeout values most parameters that can be set via mail_parameters() require your to specify a pointer to a C function. So implementing it is far from easy.
 [2003-06-13 09:43 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-06-13 09:57 UTC] thomas at xenocast dot com
Is there a windows "snap"?  Do you recommend I do that 
or  just wait for the next release?
 [2003-06-13 09:59 UTC] iliaa@php.net
Windows snap with this patch should become avaliable in a few hours.
 [2003-06-13 09:59 UTC] derick@php.net
Just go the the URL (snaps.php.net) and you will see when the last one was built. Take one built after the current time :)
 [2003-06-26 09:26 UTC] thomas at xenocast dot com
According to the 4.3.3RC1 this bug fix was referenced 
for adding the function imap_timeout().  However, the 
windows release of the above version has no 
php_imap.dll file in the extensions folder.  When I 
install the version anyway and try my script with this 
function it tells me the function doesn't exist.

Is there plans on getting the .dll file into the 
release so I can fix my script for which I posted this 
bug fix?
 [2004-03-09 07:31 UTC] becks at stepdev dot org
timeout don't works with imap/ssl connection
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 01:01:30 2024 UTC