Re: [Chicken-users] with-input-from-request does not close SSL socket
2011/12/15 Peter Bex peter@xs4all.nl: 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. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] md5 egg documentation wrong
2011/12/15 Kon Lovett konlov...@gmail.com: So: (message-digest-chunk-converter (lambda (obj) (call-with-output-string (cut serialize obj should be enough. serialize from s11n has its own limitations. I tried to write an exception to a file in order to be able to analyze it later. For the file name I tried to create a MD5 hash. So my first try was this: (with-output-to-file (md5-digest (cons (random 1) exn)) (lambda () (serialize exn))) It failed miserably ;-) I end up with this: (with-output-to-file (md5-digest (number-string (random 1))) (lambda () (write (condition-list exn This is probably the best approximation one can get. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] with-input-from-request does not close SSL socket
On Fri, Dec 16, 2011 at 11:39:56AM +0100, obscurolocon...@googlemail.com wrote: 2011/12/15 Peter Bex peter@xs4all.nl: 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? This could be done, but adding finalizers to them would cause quite a performance hit, and it wouldn't *really* fix anything. It would just sweep the problem deeper under the rug. For example, if you open a lot of files in a program that doesn't do any (or much) allocating, the GC wouldn't be triggered and you would start getting out of filedescriptors errors. 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? Not sure. Just try it, if it helps we can think about why it helps. 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. Can you reproduce it on another service? Cheers, Peter -- http://sjamaan.ath.cx -- 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 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] with-input-from-request does not close SSL socket
2011/12/16 Peter Bex peter@xs4all.nl: This could be done, but adding finalizers to them would cause quite a performance hit, and it wouldn't *really* fix anything. It would just sweep the problem deeper under the rug. For example, if you open a lot of files in a program that doesn't do any (or much) allocating, the GC wouldn't be triggered and you would start getting out of filedescriptors errors. Your problem is, that you talk about a garbage collector but think about a memory collector. A memory collector gets called when the system is out of memory. But a garbage collector must be called when the system is out of resources. So a file descriptor collector must be called if the system is out of file descriptors and not when the system is out of memory. Common Lisp has it: http://common-lisp.net/project/cmucl/doc/cmu-user/extensions.html#toc34 And as far as I can see by a quick check it seems to work. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] srfi-18 documentation for thread-sleep!
The documentation for the thread-sleep! function in the srfi-18 documentation mentions a function called current-time. But that can not be found: http://wiki.call-cc.org/search?text=ident=current-time ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] srfi-18 documentation for thread-sleep!
* Sascha Ziemann cev...@gmail.com [111216 13:45]: The documentation for the thread-sleep! function in the srfi-18 documentation mentions a function called current-time. But that can not be found: http://wiki.call-cc.org/search?text=ident=current-time Thanks for spotting this! You can replace the time-seconds part with (current-seconds). HTH, Christian -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] srfi-18 documentation for thread-sleep!
On Fri, Dec 16, 2011 at 01:43:01PM +0100, Sascha Ziemann wrote: The documentation for the thread-sleep! function in the srfi-18 documentation mentions a function called current-time. But that can not be found: http://wiki.call-cc.org/search?text=ident=current-time What do you mean? I see one result, which links to http://wiki.call-cc.org/man/4/Unit%20srfi-18 where it is documented. Also, the API docs work better when you try to search for something: http://api.call-cc.org/doc/srfi-18/current-time Cheers, Peter -- http://sjamaan.ath.cx -- 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 ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] srfi-18 documentation for thread-sleep!
Hi Sascha, On Fri, 16 Dec 2011 13:43:01 +0100 Sascha Ziemann cev...@gmail.com wrote: The documentation for the thread-sleep! function in the srfi-18 documentation mentions a function called current-time. But that can not be found: http://wiki.call-cc.org/search?text=ident=current-time You probably need (use srfi-18) in your code. See http://api.call-cc.org/doc/srfi-18/current-time Best wishes. Mario -- http://parenteses.org/mario ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] srfi-18 documentation for thread-sleep!
* Christian Kellermann ck...@pestilenz.org [111216 13:48]: * Sascha Ziemann cev...@gmail.com [111216 13:45]: The documentation for the thread-sleep! function in the srfi-18 documentation mentions a function called current-time. But that can not be found: http://wiki.call-cc.org/search?text=ident=current-time Thanks for spotting this! You can replace the time-seconds part with (current-seconds). While this works of course, it is neither part of the original problem nor adding anything to the discussion, please ignore this. -- Who can (make) the muddy water (clear)? Let it be still, and it will gradually become clear. Who can secure the condition of rest? Let movement go on, and the condition of rest will gradually arise. -- Lao Tse. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] srfi-18 documentation for thread-sleep!
2011/12/16 Peter Bex peter@xs4all.nl: Also, the API docs work better when you try to search for something: http://api.call-cc.org/doc/srfi-18/current-time Thanks! My fault. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users