On Mar 16, 2005, at 11:21 AM, Edi Weitz wrote:
On Wed, 16 Mar 2005 11:13:45 -0500, Bob Hutchison hutch@recursive.ca wrote:
Here is a better patch, it fixes a problem in the last patch I gave you yesterday (this patches your 0.4.0 release).
Argh! I already made a lot of changes compared to 0.4.0 - the patch doesn't work anymore. Could you just tell me the difference to your last patch so I can apply the modifications manually? Thanks.
I was afraid of that. Sorry. Here is the modlisp.lisp
When you make the next release I'm going to have to chase down that memory problem. I just tried a little experiment. I called the tbnl::apache-listen function from Araneida, basically inserting TBNL's handling of requests onto Araneida's handling of the sockets. There is no memory problem when this is done. The only time I get this memory problem is when I use TBNL's standard plumbing -- and it seems to me to be the krmcl:listener stuff, perhaps exclusively.
Hmm, that's with LispWorks, right? Which version? On Linux? Which KMRCL version?
Lispworks on OS/X version 4.4.0. KMRCL version 1.78
I just substituted the version of apache-listen that I've pasted into this message below for the real apache-listen.
Same problem. The real memory usage went from 70.64MB to 134.74MB, virtual memory from 289.10MB to 839.18 after 1000 requests of this page using wget. So, I've pretty much convinced myself it is KRMCL that is doing something weird.
(defun apache-listen (*apache-stream* command-processor &rest args) (declare (ignore args)) (let ((*close-apache-stream* t)) (unwind-protect (progn (loop for *apache-socket-usage-counter* from 0 do (let ((headers (read-line *apache-stream* nil nil))) #+nil (loop for key = (read-line *apache-stream* nil nil) while (and key (string-not-equal key "end")) for value = (read-line *apache-stream* nil nil) collect (cons key value)) (format t "COMMAND: ~S~%" headers) (format *apache-stream* "HTTP/1.0 200 OK~a Content-Length: 296~a Lisp-Content-Length: 296~a Content-Type: text/html; charset=iso-8859-1~a Keep-Socket: 1~a ~a <html><head><title>HELLX</title></head><body><h3>HELLX from <a href='http:// weitz.de/tbnl/'>TBNL</a> and <a href='http://www.cliki.net/Araneida'>Araneida</ a> on LispWorks 4.4.0</h3><image src='/tbnl-araneida/image/image.jpg' /><p><a href='/tbnl-araneida/form'>Fill in a Form</a></p></body></html> " #\Return #\Return #\Return #\Return #\Return #\Return) (format t "11111 ~%") (force-output *apache-stream*) (format t "22222 ~%") (setf *close-apache-stream* t) (format t "33333 ~%") (kmrcl:close-active-socket *apache-stream*) (format t "44444 ~%") (return))) (format t "55555 ~%"))
(ignore-errors (kmrcl:close-active-socket *apache-stream*)))))
Cheers, Edi.
---- Bob Hutchison -- blogs at http://www.recursive.ca/hutch/ Recursive Design Inc. -- http://www.recursive.ca/