[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] with-input-from-request does not close SSL socket

From: Peter Bex
Subject: Re: [Chicken-users] with-input-from-request does not close SSL socket
Date: Thu, 15 Dec 2011 20:43:47 +0100
User-agent: Mutt/

On Wed, Dec 14, 2011 at 08:15:30PM +0100, address@hidden wrote:
> 2011/12/14 Peter Bex <address@hidden>:
> >
> > Hm, that ought to work.  Perhaps there's a bug in the openssl egg.
> Yes it is a openssl problem.
> I was able to solve the problem by replacing http-client with the
> following code:
> Without explicitly closing the two ports, I got the same socket leaking.

That's normal for any socket, even for regular tcp sockets. You have
to close both ends before the underlying connection is closed.
This also exactly what http-client is doing when you call the
close-connection! procedure.

Have you checked that there's no trailing data?  I believe ssax:xml->sxml
reads only until the closing tag of the root node.  Maybe there's a
newline or a space following that which is not consumed, and hence the
socket stays open until you clear out all data.

If you are still having trouble, please post a full example including
the URI that's doing this.  I can't reproduce this with for example

(with-input-from-request ""; #f read-lines)

This immediately closes the socket (I guess bitbucket prefers HTTP/1.0
or uses Connection: close, I didn't bother to check).

(with-input-from-request ""; #f read-lines)

This server seems to keep around the connection for a while via HTTP/1.1
but as soon as I run (close-connection! (uri-reference "";))
the socket disappears from /proc/PID/fd.

"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

reply via email to

[Prev in Thread] Current Thread [Next in Thread]