[Lispweb] debugging and serving web pages at the same time in lisp (specifically clisp)
yinso.chen at gmail.com
Thu Oct 5 17:11:29 CDT 2006
Thanks Ivan, Richard, and Lawrence for responding - this is all very
intriguing. Sounds like CGI is the only sure way to go with Clisp if I am
looking to run multiple concurrent sessions?
Also - Lawrence, I am assuming you have a way to capture your changes in
life system back into source code form easily? I've heard the save-image
capability, but would think you still need to have source code so you can
rebuild image again if you can, is this correct?
Richard - you meant you can (trace) h-r-r in SBCL, right? In CLISP, once
(host-serve-events) is called, it blocks REPL, so I can't do trace
just-in-time without killing off the lisp session (I can't tell whether
there is a way to accept a control-character within araneida).
BTW Ivan - I did find a blog article by BillClementson discussing the same
topic at http://bc.tech.coop/blog/040224.html.
Based on all the descriptions so far, I am wondering if the development
"methodology" is completely different with lisp. I so far lived in the
compile-link-install-test world, where most of syntactic bugs and some
semantic bugs are caught during the compile phase. And that leaves the bugs
that are harder to find in live systems. Of course, examining trace files
is horrible compared to live traces, but I've found that a good majority of
the bugs found in production requires non-trivial changes (even with decent
abstraction layers) and hence my experience is that without going through
another test cycle, changing is extremely risky.
Unless... there is a way to quickly verify and rollback changes easily in
It would be great if someone with experiences in both worlds (I am sure many
of you do ;p) can share some light on whether lisp's development cycle is
completely different than c/c++/java/c# world. I've started to write lisp
code, but my limited experience does not allow me to grok this yet.
Thanks to all for help,
On 10/5/06, Lawrence Au <laau at erols.com> wrote:
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lispweb