Hi there,

I originally reported a bug with LWP/IO::Socket::SSL a little while ago. 
The bug only occurs if you do NOT have Crypt::SSLeay installed. As it is, 
LWP first looks for Crypt::SSLeay. If Crypt::SSLeay is found, well and 
good, otherwise it looks for IO::Socket::SSL.

Original report of bug can be found at (sockets left in CLOSE_WAIT state):
http://www.xray.mpe.mpg.de/mailing-lists/libwww-perl/2003-07/msg00032.html

To reproduce the bug use the test script found at:
http://www.xray.mpe.mpg.de/mailing-lists/libwww-perl/2003-07/msg00052.html

A confirmation of the bug by another list member can be found at:
http://www.xray.mpe.mpg.de/mailing-lists/libwww-perl/2003-07/msg00060.html

I have been in touch with Peter Behroozi, the author of IO::Socket:SSL. 
His explanation is quoted below:

On Tuesday at 5:01pm, PB=>Peter Behroozi wrote:

PB> Hi Haroon,
PB> 
PB> This is just a little note to let you know that I haven't forgotten
PB> you, but the problem turns out to be more difficult to fix than I had 
PB> thought.  In essence, an IO::Socket::SSL object is a reference to a
PB> filehandle.  However, in order for things like "close($ssl)" and
PB> "fileno($ssl)" to work properly, the underlying filehandle has to be a
PB> tied filehandle, and the tied object has to have a reference back to
PB> the original filehandle.  Unfortunately, the IO::Socket::SSL object 
PB> won't be auto-DESTROYed until the refcount of the filehandle drops to
PB> 0, which is exactly the same condition for the tie to be auto-broken,
PB> and while the tie remains alive, the refcount stays above 0.
PB>
PB> This is ordinarily not a problem, because the tie is properly broken
PB> when the socket is closed and so everything gets auto-cleaned.
PB> Unfortunately, LWP::Useragent never issues a call to close() and
PB> depends instead on DESTROY to auto-close the socket when the LWP
PB> object goes out of scope.  This is fine for Crypt::SSLeay, which
PB> doesn't use ties, and for IO::Socket, which uses its own XS magic, but
PB> not fine for IO::Socket::SSL.
PB> 
PB> This means that there are two options, both of which unfortunately    
PB> involve changing LWP.  One would be for me to implement a "notie"  
PB> option that does not tie the socket for users who promise not to use
PB> the tied methods, and the other option would be for LWP to have a
PB> proper DESTROY subroutine that closes the socket when the LWP object
PB> goes out of scope. As such, I would recommend that you write the    
PB> libwww-perl folk again and ask them which of the solutions would they
PB> prefer.
PB> 
PB> This means that there are two options, both of which unfortunately
PB> involve changing LWP.  One would be for me to implement a "notie"
PB> option that does not tie the socket for users who promise not to use
PB> the tied methods, and the other option would be for LWP to have a
PB> proper DESTROY subroutine that closes the socket when the LWP object
PB> goes out of scope. As such, I would recommend that you write the
PB> libwww-perl folk again and ask them which of the solutions would they
PB> prefer.
PB> 
PB> I hope that helps,
PB> 
PB> Peter
PB> 
PB> P.S. For an interim solution for you, you may disable the lines  
PB> containing "tie" or "untie" (there are 3 instances) in SSL.pm,
PB> provided that no other applications depend on IO::Socket::SSL;      
PB> 

Can any of the authors of LWP comment on the above?

Thanks,
--
Haroon Rafique
<[EMAIL PROTECTED]>

Reply via email to