[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: |
obscuroloconato |
Subject: |
Re: [Chicken-users] with-input-from-request does not close SSL socket |
Date: |
Fri, 16 Dec 2011 11:39:56 +0100 |
2011/12/15 Peter Bex <address@hidden>:
>>
>> 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.
I would say the GC must close the connection. How will you ever be
able to close the socket in this case:
(use tcp)
(let ((p (tcp-connect "localhost" 25)))
(if #f #f))
All references are lost. But the socket is still open.
But you are right. It is the same for file handles. This will also
leak resources:
(let ((p (open-input-file "/bin/bash")))
(if #f #f))
And Bigloo, Gambit and Guile do not close them either.
But this sounds somehow broken to me. File descriptors are a resource
like memory. It is a bit strange that memory gets collected but file
descriptors not. Is there a reason for this?
> Have you checked that there's no trailing data?
I think the kernel function close does not care about any data not
read when closing a socket. Is this different in Chicken?
> 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
I can not post the URI because it is an internal service of the
company I am working for. But I was able to solve the problem with the
function I have posted. So it is ok for me.