RE: [PHP] successive imap_open calls result in failure
| From: | Michael Sims | Date: | Fri, 01 Oct 2004 14:15:25 +0000 |
| Subject: | RE: [PHP] successive imap_open calls result in failure | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198422@lists.php.net to get a copy of this message | ||
felix@compsoc.nuigalway.ie wrote:
> Quoting raditha dissanayake <jabber@raditha.com>:
>> This probably means that your imap server is running under xinetd (or
>> something similar) that has a rate limit or a limit on the number of
>> connections from one client. You can find out how many connections
>> are open with netstat and i think you will find it's reached the
>> allowed limit.
>
> Cheers that does appear to be the problem, it runs under inetd and at
> the nowait argument it does not specify how many connections many be
> started within 60 seconds. Apparently its limited to 40 by default so
> this could explain why when searching 80 folders it craps out due to
> opening 80 connections without about 10 seconds.
>
> Guess I'll have to get the admins to increase the limit to something
> like 200-300 and look to see if there is any way for the php scripts
> to detect the problem and stop before hitting it.
If possible, use an IMAP proxy. The proxy will keep a pool of connections open and
when your IMP scripts request a new IMAP connection the proxy will return an
already-open one if it exists (similar to persistant SQL connections). This may
help reduce the frequency of the problem since fewer connections will open in a
given time frame. Two imap proxies:
http://www.horde.org/imapproxy/
http://www.imapproxy.org/