[closer-devel] an interesting contextl backtrace

Pascal Costanza pc at p-cos.net
Fri Dec 16 20:47:49 UTC 2011


Hi Attila,

This indeed smells like a race condition, probably caused by a class being redefined in several threads at the same time. I'm not sure if we can declare this a responsibility of the CLOS implementation or not. I see a potential workaround for this, but I would need to invest a bit of time to figure this out. (My idea is to merge the slots that need to be checked if there are already some slots recorded in compute-slots, and check them all in a single execution of finalize-inheritance, which I think should be doable with a portable locking scheme.)

I will probably not be able to do this before the end of the year, though.

A temporary workaround may to define a lock per special-class metaobject, grab the lock at the beginning of compute-slots, and release it at the end of finalize-inheritance. (I don't believe this would be portable, and I'm not sure it eliminates all possible race conditions…)

Sorry if I cannot be of any more immediate help…


Pascal

On 14 Dec 2011, at 10:54, Attila Lendvai wrote:

> Pascal,
> 
> take a look at this interesting backtrace (i've cut the irrelevant parts)!
> 
> this is triggered on sbcl and contextl head, running a threaded
> web-server. the request came from baudispider, which has a habit of
> bombing the server with parallel requests.
> 
> a quick glance at the contextl code suggests that it's a race
> condition, because the code seems to protect itself from the
> unboundness of the slot...
> 
> any thoughts? shall we send it to sbcl-devel instead?
> 
> -- 
>  attila
> 
> Notice the erosion of your (digital) freedom, and do something about it!
> 
> PGP: 2FA1 A9DC 9C1E BA25 A59C  963F 5D5F 45C7 DFCD 0A39
> OTR XMPP: 8647EEAC EA30FEEF E1B55146 573E52EE 21B1FF06
> 
> 
> 
> 
> *** At: 2011-12-13T15:35:40.427419+01:00
> *** Message:
> HANDLE-TOPLEVEL-ERROR :before is now dealing with this error
> *** In thread: http worker 1 / serving request 9 /
> HANDLE-LEVEL-1-ERROR / HANDLE-TOPLEVEL-ERROR
> *** Error of type UNBOUND-SLOT:
> The slot CONTEXTL::OLD-SLOT-DEFINITIONS is unbound in the object
> #<STANDARD-LAYER-CLASS XHTML-LAYER {1001A92ED3}>.
> *** Backtrace:
>  18: (SB-PCL::SLOT-UNBOUND-INTERNAL #<STANDARD-LAYER-CLASS XHTML-LAYER
> {1001A92ED3}> 19)
>  19: (FINALIZE-INHERITANCE #<STANDARD-LAYER-CLASS XHTML-LAYER {1001A92ED3}>)
>  20: ((SB-PCL::EMF FINALIZE-INHERITANCE) #<unavailable argument>
> #<unavailable argument> #<STANDARD-LAYER-CLASS XHTML-LAYER
> {1001A92ED3}>)
>  21: (SB-PCL::CPL-OR-NIL #<STANDARD-LAYER-CLASS XHTML-LAYER {1001A92ED3}>)
>  22: (SB-PCL::CLASS-APPLICABLE-USING-CLASS-P #<STANDARD-LAYER-CLASS
> XHTML-LAYER {1001A92ED3}> #<STANDARD-LAYER-CLASS XHTML-LAYER
> {1001A92ED3}>)
>  23: ((LABELS SB-PCL::DO-METHODS :IN
> SB-PCL::GENERATE-DISCRIMINATION-NET-INTERNAL) (0) (#<LAYERED-METHOD
> RENDER-COMPONENT-STUB # NIL # {1008D8B0F3}>) (CLASS
> #<STANDARD-LAYER-CLASS XHTML-LAYER {1001A92ED3}>) (#<LAYERED-METHOD
> RENDER-COMPONENT-STUB # # # {1008D8AD53}>) ((1 CLASS #)))
>  24: ((LABELS SB-PCL::DO-METHODS :IN
> SB-PCL::GENERATE-DISCRIMINATION-NET-INTERNAL) (0) (#<LAYERED-METHOD
> RENDER-COMPONENT-STUB #1=# # # {1008D8AD53}> #<LAYERED-METHOD
> RENDER-COMPONENT-STUB #1# NIL # {1008D8B0F3}>) T NIL ((1 CLASS #)))
>  25: ((LABELS SB-PCL::DO-METHODS :IN
> SB-PCL::GENERATE-DISCRIMINATION-NET-INTERNAL) (1 0) (#<LAYERED-METHOD
> RENDER-COMPONENT-STUB #1=# # # {1008D8AD53}> #<LAYERED-METHOD
> RENDER-COMPONENT-STUB #1# NIL # {1008D8B0F3}>) T NIL NIL)
>  26: (SB-PCL::DISPATCH-DFUN-COST #<LAYERED-FUNCTION
> RENDER-COMPONENT-STUB {10036FEDAB}> 60)
>  27: (SB-PCL::USE-DISPATCH-DFUN-P #<LAYERED-FUNCTION
> RENDER-COMPONENT-STUB {10036FEDAB}> NIL)
>  28: (SB-PCL::MAKE-CHECKING-DFUN #<LAYERED-FUNCTION
> RENDER-COMPONENT-STUB {10036FEDAB}> #S(SB-PCL::FAST-METHOD-CALL
> :FUNCTION #<CLOSURE # {100DDF059B}> :PV NIL :NEXT-METHOD-CALL NIL
> :ARG-INFO (2)) NIL)
>  29: (SB-PCL::INITIAL-DFUN #<LAYERED-FUNCTION RENDER-COMPONENT-STUB
> {10036FEDAB}> (#<LAYER NIL {100CE8E153}> #<CONTEXT-MENU/WIDGET
> :MENU-ITEMS #>))
>  30: ((LABELS HU.DWIM.PRESENTATION::WITH-RENDER-STYLE/COMPONENT-BODY
> :IN HU.DWIM.PRESENTATION::=LAYERED-FUNCTION-DEFINER-FOR-RENDER-COMPONENT=))
> 
> _______________________________________________
> closer-devel mailing list
> closer-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/closer-devel

--
Pascal Costanza
The views expressed in this email are my own, and not those of my employer.







More information about the closer-devel mailing list