[Openmcl-devel] Faceless Background Server Behavior

Hamilton Link helink at sandia.gov
Wed Jan 8 09:45:45 PST 2003

Sorry, that last one should have had a reply on it.

Anyway, what I suspect is happening is something like:
- Lisp starts
- The initial process evaluates the spawn-tiny-server function, 
spinning off another thread
- The initial process, finding itself with nothing left to do, 
- The app terminates, because it's dependent upon the initial process


On Wednesday, January 8, 2003, at 03:16 AM, Sven Van Caekenberghe wrote:

> 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

Openmcl-devel mailing list
Openmcl-devel at clozure.com

More information about the Openmcl-devel mailing list