[Openmcl-devel] Faceless Background Server Behavior

Sven Van Caekenberghe sven at beta9.be
Wed Jan 8 02:16:44 PST 2003


I was trying to turn OpenMCL into a faceless background server. Given 
this code (in the file tiny-server.lisp):

(defun tiny-server ()
   (with-open-socket (server-socket :connect :passive
				   :local-port 1701
				   :reuse-address t)
     (loop
      (let* ((client-socket (accept-connection server-socket))
	    (in (read client-socket))
	    (out (expt in in)))
        (format client-socket "~d~%" out)
        (finish-output client-socket)
        (close client-socket)))))

(defun spawn-tiny-server ()
   (process-run-function "tiny-server" #'tiny-server))

I can run the (single threader) server like this:

openmcl -l tiny-server -e '(tiny-server)'

Using telnet locahost 1701, typing a number and return, the server 
responds with the result of evaluating (expt number number) and then 
disconnects. To turn this server into a faceless background server, I 
can do this:

nohup openmcl -l tiny-server -e '(tiny-server)' &

and it works (and keeps on working when I log out). This is the 
behavior I was looking for. However, when I use the second function, 
like this:

nohup openmcl -l tiny-server -e '(spawn-tiny-server)' &

The server works for a small amount of time (a couple of requests) and 
then stops working. This is what puzzeled me the first time I tried to 
put my XML-RPC server in the background.

I have the impression that the interactive listener process is not 
happy about being put in background (although I am not sure how that 
could affect the interactive streams since they are not really used). 
Is this behavior intentional ?

Sven

--
Sven Van Caekenberghe - mailto:sven at beta9.be
Beta Nine - software engineering - http://www.beta9.be
.Mac - svc at mac.com - http://homepage.mac.com/svc


_______________________________________________
Openmcl-devel mailing list
Openmcl-devel at clozure.com
http://clozure.com/cgi-bin/mailman/listinfo/openmcl-devel



More information about the Openmcl-devel mailing list