[plt-scheme] Servlet Timeouts

From: Arend P. van der Veen (apvanderveen at att.net)
Date: Thu Jul 1 08:16:32 EDT 2004


I have been attempting to test the servlet timeout feature to confirm 
that the system reclaims continuations used by a servlet.  To perform 
this test I wrote a function (in Python) on another machine that 
accessed the add.ss example servlet.  The function submits the first 
number but never submits the second number.  I call this function 40,000 
times.  According to my web server configuration file I would expect 
that the servlet should time out in two minutes (default servlet timeout 
= 120 seconds).   After I completed my test the web server process has 
consumed about 152 MB of RAM.     I think that the memory consumption 
has stabilized even if I rerun the test (and not restart the web 
server).  Also, it takes much more then 2 minutes for my python client 
to access the server 40,000 times.

1.   I was originally having problems with the add servlet leaking 
memory.  I included a send/finish at the end of the unit.  My new add.ss 
is at the end of this post.  Am I correct in assuming that this servlet 
should not leak memory now ?

2.   Do the log files contain any information indicating that a servlet 
has timeout ?  I was not able to find any indications.

3.   When the servlet times out should all the RAM associated with the 
servlet be automatically released ?

Thanks in advance for your help.
Arend van der Veen


(require (lib "unitsig.ss")
         (lib "servlet-sig.ss" "web-server")
         (lib "servlet-helpers.ss" "web-server")
         (lib "date.ss"))

(unit/sig () (import servlet^)
  ; request-number : str -> num
  (define (request-number which-number)
      (request-bindings (send/suspend (build-request-page which-number))))))
  ; build-request-page : str -> str -> response
  (define (build-request-page which-number)
    (lambda (k-url)
      `(html (head (title "Enter a Number to Add"))
             (body ([bgcolor "white"])
                   (form ([action ,k-url] [method "post"])
                         "Enter the " ,which-number " number to add: "
                         (input ([type "text"] [name "number"] [value ""]))
                         (input ([type "submit"] [name "enter"] [value 
  (define (answer-page)
    `(html (head (title "Sum"))
         (body ([bgcolor "white"])
               (p "The sum is "
              ,(number->string (+ (request-number "first") 
(request-number "second")))))))

  (send/finish (answer-page)))

Posted on the users mailing list.