[hunchentoot-devel] thread safety in session-value

Anton Vodonosov avodonosov at yandex.ru
Wed Sep 3 21:22:23 UTC 2008


on Wednesday, September 3, 2008, 11:51:25 PM Hans wrote:

> On Wed, Sep 3, 2008 at 22:32, Anton Vodonosov <avodonosov at yandex.ru> wrote:
>> Just noticed in the sources that SESSION-VALUE
>> code does not have WITH-LOCK. IMHO it is necessary
>> here.

> Can you please be more specific?  Thanks.

I thought that several functions work with the same list
- SESSION-DATA slot of the session.

For example if DELETE-SESSION-VALUE will happen in parallel
with with (SESSION-VALUE ...) we will have ASSOC and
DELETE on the same list simultaneously, which is
IMHO unsafe.

(SETF (SESSION-VALUE)..)) with (DELETE-SESSION-VALUE
looks unsafe too: SETF does (push <something> (slot-value ,%session
'session-data)) and in the same time in the DELETE-SESSION-VALUES
(setf (slot-value session 'session-data). PUSH is not necessary
atomic, IMHO; is it safe to use it in parallel with SETF?

P.S. DELETE-SESSION-VALUE should use look too.

- Anton




More information about the Tbnl-devel mailing list