Dave Fischetti wrote:
> Hey everyone. I've been using EZComponents for  a while for parsing  
> incoming mail for a service I run. I have never been able to figure  
> out what is causing the following error and Its starting to show up  
> way to often now. I'm not sure if its a memory resource issue or  
> something else at this point. the server is running lean on memory  
> lately. I need to upgrade.
> 
> It works most of the time but sometimes dies. I'm mostly receiving  
> simple emails from cell phones via text message. Nothing to fancy to  
> parse. When the error occurs. the file is not process but the email is  
> deleted.
> 
> I would really appreciate any feedback that would point me to the  
> problem. My parsing script is very long b/c it runs different things  
> for different cases, so maybe I can email it to anyone that may be  
> interested in looking at it. But any feedback on the error itself is  
> appreciated.
> 
> Thanks,
> Fish
> 
> <br />
> <b>Fatal error</b>:  Uncaught exception 'ezcMailTransportException'  
> with message 'An error occured while sending or receiving mail. Could  
> not read from the stream. It was probably terminated by the host.' in / 
> usr/include/php/ezcomponents-2007.2.1/Mail/src/transports/ 
> transport_connection.php:217
> Stack trace:
> #0 /usr/include/php/ezcomponents-2007.2.1/Mail/src/transports/pop3/ 
> pop3_transport.php(365): ezcMailTransportConnection-&gt;getLine()
> #1 /var/www/vhosts/mydomain.com/httpdocs/parserScript.php5(50):  
> ezcMailPop3Transport-&gt;authenticate('[EMAIL PROTECTED]', 'password')
> #2 {main}
>   thrown in <b>/usr/include/php/ezcomponents-2007.2.1/Mail/src/ 
> transports/transport_connection.php</b> on line <b>217</b><br />

Hi Dave,

It seems that there is a bug in the getLine() function in 
ezcMailTransportConnection(Mail/src/transports/transport_connection.php), 
which causes the uncaught exception above. getLine() tries to read in 
blocks of 512 from the server until it encounters CRLF. But in the 
function, if the CRLF is split in 2 different blocks (for example trying 
to read 511 characters + CR + LF, which is 2 blocks of 512) then it will 
throw that exception.

I opened an issue for this (http://issues.ez.no/13010), and it will be 
fixed soon for the 2008.1 (beta1) release of eZ Components.

If you need the fix in your version (I see you are still using 2007.2.1) 
you can modify it yourself: in 
Mail/src/transports/transport_connection.php, in the function getLine() 
on line 207 you have:

<code>
while ( strpos( $line, self::CRLF ) === false )
</code>

Change this to:
<code>
while ( strpos( $data, self::CRLF ) === false )
</code>

Dave, can you please check if this helps?

> On a side note: I'm also seeing this error pop up once and a while:
> 
> <br />
> <b>Warning</b>:  mkdir() [<a href='function.mkdir'>function.mkdir</ 
> a>]: File exists in <b>/usr/include/php/ezcomponents-2007.2.1/Mail/src/ 
> parser/parts/file_parser.php</b> on line <b>128</b><br />
> <br />
> <b>Warning</b>:  mkdir() [<a href='function.mkdir'>function.mkdir</ 
> a>]: File exists in <b>/usr/include/php/ezcomponents-2007.2.1/Mail/src/ 
> parser/parts/file_parser.php</b> on line <b>128</b><br />
> 

This mkdir() warning is probably caused by the uncaught exceptions 
earlier, because the temporary directories are deleted in the destructor 
from file_parser.php, which is not executed if an exception is thrown 
earlier. We will try to add a fix for this so that the directory is not 
created if it already exists.

Cheers,
Alex.

-- 
Alexandru Stanoi
eZ Components System Developer
eZ Systems | http://ez.no
-- 
Components mailing list
Components@lists.ez.no
http://lists.ez.no/mailman/listinfo/components

Reply via email to