Advertisement
Guest User

thread bug on ARMCL RPI

a guest
Jan 11th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 2.25 KB | None | 0 0
  1.  
  2. ;; (THREADTEST ..) launches some threads that generate garbage.
  3. ;; It crashes on latest rpi deb build  with:
  4. ;;   > Unhandled exception 4 at 0x1512acec, context->regs at #x74d64490
  5.  
  6. ;; specifically, it
  7. ;; crashes on raspberri pi armcl dev version:
  8. ;;        * "Version 1.12-dev (v1.12-dev.4-3-gdd5622e9) LinuxARM32"
  9. ;; but does NOT crash on release version:
  10. ;;        * "Version 1.11.5/v1.11.5  (LinuxARM32)"
  11.  
  12.  
  13. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  14. ;; It also seems to expose a locking problem in Version 1.11.5 when
  15. ;; run as (threadtest :loop-count 10000 :exercise-locking) to force
  16. ;; allocations inside the threads to take place inside a
  17. ;; with-lock-grabbed, the error:
  18. ;;
  19. ;;  Current process #<PROCESS Reader 4(26) [Active] #x150D335E> does not own
  20. ;;  lock #<RECURSIVE-LOCK "glock" [ptr @ #x76105C60] #x150BB0D6>
  21. ;;
  22. ;; occurs in CCL::%UNLOCK-RECURSIVE-LOCK-OBJECT
  23. ;;
  24. ;; could this locking problem be the source of the threading bug here?
  25. ;; https://trac.clozure.com/ccl/ticket/1257
  26.  
  27.  
  28. (defparameter *the-glock* nil) ;; allow us to look at lock while running
  29.  
  30. (defun threadtest (&key
  31.              (thread-count 7)
  32.              (loop-count 1000)
  33.              (exercise-locking nil)
  34.              (garbage-count 1000))
  35.   (let ((done-flags (make-array thread-count :initial-element nil))
  36.     (lock (ccl:make-lock "done-flags-lock"))
  37.     (glock (when exercise-locking
  38.          (ccl:make-lock "glock"))))
  39.     (setf *the-glock* glock)
  40.     (dotimes (i thread-count)
  41.       (process-run-function
  42.        (format nil "Reader ~d" i)
  43.        (lambda (i)
  44.      (unwind-protect
  45.           (dotimes (j loop-count)
  46.         #+nil ;; temporarily remove this additonal complication
  47.         (setf (ccl:process-name ccl:*current-process*)
  48.               (format nil "Reader ~d: ~d" i j))
  49.         (garbagemaker garbage-count glock)
  50.         ))
  51.      (ccl:with-lock-grabbed (lock) (setf (elt done-flags i) t)))
  52.        i))
  53.     (loop do
  54.          (unless
  55.          (ccl:with-lock-grabbed (lock)
  56.            (position nil done-flags))
  57.        (return)))))
  58.  
  59.  
  60. ;; make some garbage, optionally grab a lock to exercise
  61. ;; locking in threads
  62. (defun garbagemaker (garbage-count lock)
  63.   (loop for i below garbage-count
  64.      collect (if lock
  65.            (ccl:with-lock-grabbed (lock)
  66.          (make-string 10))
  67.            (make-string 10))))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement