[hunchentoot-devel] thread safety in session-value

Edi Weitz edi at agharta.de
Thu Sep 4 21:14:59 UTC 2008


On Thu, 4 Sep 2008 23:36:01 +0300, Anton Vodonosov <avodonosov at yandex.ru> wrote:

> Yes, such a contract may be used too, although in this case it looks
> to me that user must take care of locking in virtually 100% of cases
> - even single handler may be called from different threads for the
> same session.

Yes, you're right.  I never had problems with this so far, but maybe
this is because I've rarely used Hunchentoot with SMP Lisps.

In this case, you don't want to use a global lock, though, and I
wonder how expensive it is to have one lock per session.  I have to
think about this a bit...

> In fact my attention to this question was drawn by the fact that
> (SETF (SESSION-VALUE )) uses lock, but other functions do not.

The lock in (SETF SESSION-VALUE) is clearly unneeded as START-SESSION
already has a lock.  As the name says, *SESSION-DATA-LOCK* was only
meant to protect *SESSION-DATA*.

> If you wonder why am I poking in the hunchentoot code

Oh, that's fine.  Feel free to poke around and find more bugs... :)



More information about the Tbnl-devel mailing list