Discussion:
an interesting contextl backtrace
Attila Lendvai
2011-12-14 09:54:03 UTC
Permalink
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=))
Pascal Costanza
2011-12-16 20:47:49 UTC
Permalink
Content preview: 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.) [...]

Content analysis details: (-100.0 points, 5.0 required)

pts rule name description
---- ---------------------- --------------------------------------------------
-100 USER_IN_WHITELIST From: address is in the user's white-list
Archived-At: <http://permalink.gmane.org/gmane.lisp.closer.devel/327>

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
Post by Attila Lendvai
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
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
The slot CONTEXTL::OLD-SLOT-DEFINITIONS is unbound in the object
#<STANDARD-LAYER-CLASS XHTML-LAYER {1001A92ED3}>.
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
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.
Loading...