[closer-devel] *root-context* and threads
Pascal Costanza
pc at p-cos.net
Tue Nov 6 07:52:42 UTC 2007
Hi,
On 5 Nov 2007, at 22:11, Attila Lendvai wrote:
> hi!
>
> we are having issues with our contextl-heavy code on sbcl with high
> load. i suspect that the problem happens due to currupting sbcl's
> internal state due to some missing locks in sbcl, but while i was
> reviewing the code i had a question: seems like *active-context* is
> holding some caches, but i can't see where *root-context* is protected
> from concurrent access.
Indeed, there is no protection against concurrent access.
> maybe the code should eq-check for *root-context* at some point and
> enforce a separate *active-context* on first use? this will of curse
> lower the cache efficiency, so maybe a cross-platform threading lib
> like bordeaux-threads could be used to protect the global cache or
> somehow ensure that *root-context* is rebound and copied in all
> threads (i think this needs some platform specific code).
>
> is this analysis correct at all?
I don't think it's sufficient. Two different threads may see the same
*active-context* at the same time, even if it's not the *root-
context*, so accesses to the caches should probably be synchronized
all the time. (Although it would probably be acceptable if caches are
not updated every now and then.)
Currently, the ContextL caches are implemented using property lists.
Does anyone know of a straightforward way to make property lists (or
assocation lists or hashtables) threadsafe in an implementation-
independent way, possibly using some kind of compatibility layer?
Pascal
> --
> attila
>
> fyi, the sbcl backtrace:
>
> bad thing to be a type specifier: #<CONTEXTL:STANDARD-LAYER-CLASS NIL
> {100CE950C1}>
> *** Backtrace is:
> 000: ((LAMBDA (ERROR)) #<SIMPLE-ERROR {100A281D11}>)
> 001: ((LAMBDA (ERROR)) #<SIMPLE-ERROR {100A281D11}>)
> 002: ((LAMBDA (ERROR)) #<SIMPLE-ERROR {100A281D11}>)
> 003: (SIGNAL #<SIMPLE-ERROR {100A281D11}>)
> 004: (ERROR \"bad thing to be a type specifier: ~S\")
> 005: (SB-KERNEL:VALUES-SPECIFIER-TYPE #<CONTEXTL:STANDARD-LAYER-CLASS
> NIL {100CE950C1}>)
> 006: (SB-KERNEL:SPECIFIER-TYPE #<CONTEXTL:STANDARD-LAYER-CLASS NIL
> {100CE950C1}>)
> 007: (SUBTYPEP #<CONTEXTL:STANDARD-LAYER-CLASS NIL {100CE950C1}>
> #<CONTEXTL:STANDARD-LAYER-CLASS EBR42-LAYER {1001760DB1}> #<unused
> argument>)
> 008: ((SB-PCL::FAST-METHOD
> LAYERED-FUNCTION-DEFINERS::|CONTEXTL::ADJOIN-LAYER-USING-CLASS| (T
> CONTEXTL:STANDARD-LAYER-CLASS T)) #<error printing object>)
> 009: (CONTEXTL:ADJOIN-LAYER #<unavailable argument> #<unavailable
> argument>)
> 010: ((LAMBDA ()))
> _______________________________________________
> closer-devel mailing list
> closer-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/closer-devel
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the closer-devel
mailing list