[Openmcl-devel] bug with static-cons

Jared C. Davis jared at cs.utexas.edu
Wed Nov 26 14:28:49 PST 2014


Hi,

I believe there is a bug with the interaction of static-cons, rplacd, and
multithreading.

Here is a distilled test that reliably provokes the problem on my system.

  (defun make-some-static-conses (n)
    (if (= n 0)
        nil
      (let ((cons (ccl::static-cons n nil)))
        (rplacd cons "foo")
        (cons cons (make-some-static-conses (- n 1))))))

  (defun my-test ()
    (make-some-static-conses 1000)
    nil)

  (loop for i from 1 to 1000 do
        (format t "i is ~D~%" i)
        (loop for nthreads from 1 to 10 do
              (ccl::process-run-function 'test-thread 'my-test)))

A log and a backtrace are attached.

I ran into this on Version 1.10-dev-r16190M-trunk (LinuxX8664).  I seem
able to reproduce it on Version 1.11-dev-r16313M-trunk (LinuxX8664).

Thanks!
Jared


Log:

    Welcome to Clozure Common Lisp Version 1.10-dev-r16190M-trunk  (LinuxX8664)!
    i is 1
    i is 2
    i is 3
    i is 4
    [ .... many lines elided ... ]
    i is 174
    i is 175
    > Error: The value "foo" is not of the expected type CONS.
    > While executing: STATIC-CONS> Error: Invalid memory operation.
    > Error: Invalid memory operation.
    > While executing: CCL::%ATOMIC-POP-STATIC-CONS> Error: Invalid
memory operation.
    > While executing: CCL::%ATOMIC-POP-STATIC-CONS> While executing:
CCL::%ATOMIC-POP-STATIC-CONS, in process TEST-THREAD(1739).
    , in process TEST-THREAD(1742).
    , in process TEST-THREAD(1740).
    , in process TEST-THREAD(1741).



    ;;;
    ;;;
    ;;;

    ;;;
    ;;;
    ;;;
    ;;; ;;; #<#<PROCESS#< #<PROCESS
TEST-THREADPROCESSTEST-THREADPROCESS ((TEST-THREAD1739)( 17401741 [))
[ [TEST-THREADActive]Active(]Active1742  )##xx
[]30200DE29AAD30200DE28FED >Active# requires access to xShared
Terminal Input] #x30200DE2852D>30200DE2A56D requires access to Shared
Terminal Input
    >>
    ;;; Type (:y  requires access to 1741) to yield control to this
thread.;;; Type (:y  requires access to
    Shared Terminal Input;;;1740
    Shared Terminal Input

    [ .... many lines elided ... ]


Backtrace: (well, not too surprising I guess...)

    ? (:y 1741)
    ;;;
    ;;; Shared Terminal Input is now owned by #<PROCESS
TEST-THREAD(1741) [Active] #x30200DE28FED>
    ;;;

    > Type :POP to abort, :R for a list of available restarts.
    > Type :? for other options.
    1 > :b
    :b
    *(2AC32D37DDA0) : 0 (%ATOMIC-POP-STATIC-CONS) 23
     (2AC32D37DE38) : 1 (MAKE-SOME-STATIC-CONSES 1000) 101
     (2AC32D37DE50) : 2 (MY-TEST) 37
     (2AC32D37DE60) : 3 (RUN-PROCESS-INITIAL-FORM
CCL::%ATOMIC-POP-STATIC-CONS (#<COMPILED-LEXICAL-CLOSURE #
#x30200DE28D5F>)) 709
     (2AC32D37DEF0) : 4 (FUNCALL #'#<(:INTERNAL
(CCL::%PROCESS-PRESET-INTERNAL (PROCESS)))> #<PROCESS
TEST-THREAD(1741) [Active] #x30200DE28FED> (#<COMPILED-LEXICAL-CLOSURE
# #x30200DE28D5F>)) 573
     (2AC32D37DF98) : 5 (FUNCALL #'#<(:INTERNAL
CCL::THREAD-MAKE-STARTUP-FUNCTION)>) 277

-- 
Jared C. Davis <jared at cs.utexas.edu>
11410 Windermere Meadows
Austin, TX 78759
http://www.cs.utexas.edu/users/jared/



More information about the Openmcl-devel mailing list