Skip Menu |

This queue is for tickets about the Mail-IMAPClient CPAN distribution.

Report information
The Basics
Id: 36976
Status: resolved
Priority: 0/
Queue: Mail-IMAPClient

People
Owner: Nobody in particular
Requestors: phota001 [...] yahoo.com.cn
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: possible solution for select() timeouts in reading from SSL socket
Date: Sat, 21 Jun 2008 10:36:15 +0800 (CST)
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Renjie Guan <phota001 [...] yahoo.com.cn>
Hi David or Mark, I'm using Mail::IMAPClient v3.07 on Perl v5.10.0 on a Linux 2.6.24 box. I encountered the same timeout problem as reported on CPAN (http://rt.cpan.org/Public/Bug/Display.html?id=31655). On reading from SSL socket, I see in the debug log that all the email body has been downloaded, but the module waits indefinitely in select() from the socket to be ready to read, and finally times out (in sub _read_line). I found the following quote that might be useful to indicate the cause and help to solve the problem (by "Rob Mueller" <robm@fastmail.fm>). Show quoted text
> SSL sockets have some slightly strange features which can break > existing code that relies on certain assumptions of regular sockets. > > The main one being that you might syswrite() or print() some data > to send to the server, and be expecting a response, so you use a > select() call on the file descriptor to wait for the server to > respond. However because of the way SSL works, in fact, the SSL > layer may want to do a "write" on the socket, not a read. The net > result of this is that the other end never returns data, and your > select() times out. > > The solutions are either: > 1. Don't use select(), but that means timeouts are hard to do. > 2. You need to use select() + non-blocking, and look for > SSL_WANT_WRITE errors
I'm not capable enough myself to propose workable codes. But I think this piece of information would be useful to improve the module. Thanks Renjie Guan Show quoted text
___________________________________________________________ 雅虎邮箱,您的终生邮箱! http://cn.mail.yahoo.com/
CC: gonullu [...] bluewin.ch
Subject: Re: [rt.cpan.org #36976] possible solution for select() timeouts in reading from SSL socket
Date: Sun, 22 Jun 2008 12:57:57 +0200
To: Renjie Guan via RT <bug-Mail-IMAPClient [...] rt.cpan.org>
From: NLnet webmaster <webmaster [...] nlnet.nl>
Renjie, This certainly sounds like a solution. Maybe, it is suffucient to set the write-bits in the selects as well... But... I neither have the environment nor the time to test/(re)implement this. Waiting for someone who has... MarkOv * Renjie Guan via RT (bug-Mail-IMAPClient@rt.cpan.org) [080621 02:36]: Show quoted text
> Fri Jun 20 22:36:52 2008: Request 36976 was acted upon. > Transaction: Ticket created by phota001@yahoo.com.cn > Queue: Mail-IMAPClient > Subject: possible solution for select() timeouts in reading from SSL socket
Show quoted text
> I'm using Mail::IMAPClient v3.07 on Perl v5.10.0 on a Linux 2.6.24 box. I > encountered the same timeout problem as reported on CPAN > (http://rt.cpan.org/Public/Bug/Display.html?id=31655). On reading from SSL > socket, I see in the debug log that all the email body has been downloaded, but > the module waits indefinitely in select() from the socket to be ready to read, > and finally times out (in sub _read_line). > > I found the following quote that might be useful to indicate the cause and help > to solve the problem (by "Rob Mueller" <robm@fastmail.fm>). >
> > SSL sockets have some slightly strange features which can break > > existing code that relies on certain assumptions of regular sockets. > > > > The main one being that you might syswrite() or print() some data > > to send to the server, and be expecting a response, so you use a > > select() call on the file descriptor to wait for the server to > > respond. However because of the way SSL works, in fact, the SSL > > layer may want to do a "write" on the socket, not a read. The net > > result of this is that the other end never returns data, and your > > select() times out. > > > > The solutions are either: > > 1. Don't use select(), but that means timeouts are hard to do. > > 2. You need to use select() + non-blocking, and look for > > SSL_WANT_WRITE errors
> > I'm not capable enough myself to propose workable codes. But I think this piece > of information would be useful to improve the module. > > Thanks > > Renjie Guan
I hope you can experiment with it, otherwise I will close the ticket.
Subject: Re: [rt.cpan.org #36976] possible solution for select() timeouts in reading from SSL socket
Date: Fri, 12 Dec 2008 12:12:19 +0800
To: bug-Mail-IMAPClient [...] rt.cpan.org
From: Renjie Guan <phota001 [...] yahoo.com.cn>
I experimented with version 3.12 and it looks good. Thanks a lot for the fix!
I am not aware of having fixed anything, but if you are happy, then I am happy ;-)