[Armedbear-devel] How to get a fresh session or instance

Alessio Stalla alessiostalla at gmail.com
Wed Dec 10 20:13:25 UTC 2014


On Wed, Dec 10, 2014 at 7:02 PM, Robert Dodier <robert.dodier at gmail.com>
wrote:

> On 2014-12-10, Mark Evenson <evenson at panix.com> wrote:
>
> > The Lisp environment is a global singleton per JVM process, like that
> > of any other Lisp implementation is per OS process.
>
> Hmm, I wonder if it's possible to use multiple classloaders to get
> separate ABCL environments ...
>

Yes, it's possible. You just have to be careful and avoid sharing any
ABCL-related class among classloaders through a common ancestor. I.e. you
have to load ABCL from a location unknown to the JVM (not from CLASSPATH
nor the webapp's libs, etc.).


>
> > To carry forward the comparison with SBCL:  what would it take to
> > make SBCL have a “fresh instance”?
>
> SBCL has some POSIX functions, including fork, which makes possible
> the conventional Unixy client/server model. I'm not trying to create
> exactly that functionality for ABCL but it is not too far off.
>

fork() has an important difference: it allows some state to be shared, at
the discretion of the programmer - things start to diverge only from fork()
onwards. With separate classloaders, in general you either have total
sharing or total isolation, no middle ground (unless you introduce message
buses or other means of communication, but then you're moving away from the
fork() model, as far as I know it, which is very little).

>
> > Could you be more specific about your use case?
>
> Well, I am loading ABCL and then Maxima into a Jetty servlet.
> The servlet class exposes a few methods which call Maxima functions
> to provide some services to Flex clients; BlazeDS is the glue.
> I'd like to figure out a way to ensure that different browser
> sessions don't step on each others toes. Maxima itself doesn't
> have any way to do that.
>

Define "step on each other's toes". Do you mean redefining things? Access
to global variables? Or that simply evaluating an arbitrary Maxima form has
potential concurrency issues? Would simply loading Maxima in different Lisp
packages work and be enough for you?
In general, one ABCL instance per HTTP session doesn't seem a very smart
thing to do. It is smarter than one full JVM per session, but not terribly
so. Alas, maybe you cannot avoid it. You'll probably want to pool instances
so as to have a fresh one ready when you need it and not incur in startup
time costs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20141210/68a58fd2/attachment.html>
-------------- next part --------------
_______________________________________________
Armedbear-devel mailing list
Armedbear-devel at common-lisp.net
http://mailman.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel


More information about the armedbear-devel mailing list