[Lispweb] debugging and serving web pages at the same time in lisp (specifically clisp)

Lawrence Au laau at erols.com
Thu Oct 5 09:44:16 CDT 2006

      I run PortableAserve on top of Lispworks and I fix hot live 
bugs all the time.  It's the fastest way to fix bugs;  I inspect the 
production data in the Listener to diagnose and then redefine actual 
functions and data in the Listener to fix the bugs.  My web pages are
all served from a set of structures rooted in global variables which
define multiple concurrent session states,
so individual sessions state is fully accessible from any Lisp thread,
such as the Listener.   The individual web pages are computed
from these structures for each http-get,  so on the client web browser,
just flushing cache and reloading the page to displays the fixed 

     This avoid having to replicate bugs before fixing them,
and avoids time consuming turnover actions.  I fix actual problems
directly,  instead of approximations of those problems.  Most bugs
are just typos,  which are great to fix this way.  Of course if the bug
required a serious rewrite,  I'd do the rewrite on a test server.
However,  the data I can pull from a production Listener is really
valuable in setting up the test cases on the test server.  Since Lisp
structure print out as loadable versions of their contents,  I can
just cut and paste the full session state to a test server to replicate
specific problems there.  Of course it's important to drive 
http handlers with functions that take a single structure argument,
(whose structure fully describe session state)  otherwise that cut and 
would have multiple pieces which would have to be loaded together
by hand.

    Paul Graham is right.  I have found Lisp to be about 3x more elegant 
any other web serving technology.  By this I mean that one person
can easily do the work of three.

Lawrence Au
Q-Phrase LLC

On Oct 5, 2006, at 1:41 AM, Yin-So Chen wrote:

> Hi lisp gurus-
> sorry if this (newbie) question has been asked before - I tried to 
> search for the information on the web but can't (probably because it's 
> hard to tell what the keyword is).  I am wondering if it is possible 
> to debug and serve webpage at the same time in lisp (specifically 
> clisp) and verify my underestanding.
> The reason I am wondering is that I've read Paul Graham's note on his 
> experience in viaweb he was able to diagnose a problem while the 
> customer is on the phone.  His statement implies that he was running a 
> separate instance of the website (so not the same one as the 
> customer's looking at), but he attempt to reproduce the problem and 
> can fix it at the same time (all appearing without having to shutdown 
> the production image). 
> You can find the excerpt here: 
> http://lib.store.yahoo.net/lib/paulgraham/bbnexcerpts.txt
> After playing a bit with araneida's example - it seem that with clisp 
> this is not possible - because (host-serve-events) blocks repl.  I 
> didn't try this on SBCL, but assuming it has multi-threads I can see 
> it being a possibility.
> Another way I can think of is that he built an abstraction layer that 
> allow him to work from repl to reproduce a problem discovered through 
> a web server request, so he can work in session to fix the problem, 
> but I can't see how he can update the running clisp image without 
> having to kill the current web server session (assuming he has 
> something that works similar to araneida) and reload code.
> Please let me know if I am missing something obvious.  While I don't 
> know if I agree with the practice of directly changing production code 
> in real-time, the concept is intriguing, and certainly would be great 
> to know how it's done.
> Oh - I am using clisp now as I am doing work on windows.  I might move 
> to sbcl on linux but certainly would love to understand how it's done.
> Thanks for any comments,
> yinso
> _______________________________________________
> lispweb mailing list
> lispweb at red-bean.com
> http://www.red-bean.com/mailman/listinfo/lispweb

More information about the lispweb mailing list