1.0.25.51: use WITH-RECURSIVE-SYSTEM-SPINLOCK
authorGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 22:26:25 +0000 (22:26 +0000)
committerGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 22:26:25 +0000 (22:26 +0000)
... instead of WITH-RECURSIVE-SPINLOCK because it's possible to
deadlock due to lock ordering with sufficiently unlucky interrupts as
demonstrated by test (:timer :parallel-unschedule) with low
probability.

This affects hash tables and some pcl locks.

Also, use WITH-RECURSIVE-MUTEX for packages.

Not a spinlock becuase it can be held for a long time and not a system
lock (i.e. with WITHOUT-INTERRUPTS) because conflicts are signalled
while holding the lock which I think this warrants a FIXME.

NEWS
src/code/hash-table.lisp
src/code/target-package.lisp
src/pcl/std-class.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 3d91a48..7ce43b4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,8 @@ changes in sbcl-1.0.26 relative to 1.0.25:
     memory, stack, alien stack, binding stack, encountering a memory
     fault, etc. In the absence of --lose-on-corruption a warning is
     printed to stderr.
+  * enhancement: detect binding stack exhaustion
+  * enhancement: detect alien stack exhaustion on x86/x86-64
   * improvement: generally more stable and reliable interrupt handling
   * improvement: there is a per thread interruption queue,
     interruptions are executed in order of arrival
@@ -37,6 +39,8 @@ changes in sbcl-1.0.26 relative to 1.0.25:
   * bug fix: fix deadlocks related to starting threads
   * bug fix: fix deadlines on locks on futex platforms
   * bug fix: restore errno in signal handlers
+  * bug fix: fix deadlocks related to hash tables
+  * bug fix: fix deadlocks in pcl
 
 changes in sbcl-1.0.25 relative to 1.0.24:
   * incompatible change: SB-INTROSPECT:FUNCTION-ARGLIST is deprecated, to be
index ca66744..784bc11 100644 (file)
@@ -147,5 +147,6 @@ unspecified."
   ;; Needless to say, this also excludes some internal bits, but
   ;; getting there is too much detail when "unspecified" says what
   ;; is important -- unpredictable, but harmless.
-  `(sb!thread::with-recursive-spinlock ((hash-table-spinlock ,hash-table))
+  `(sb!thread::with-recursive-system-spinlock
+       ((hash-table-spinlock ,hash-table))
      ,@body))
index 4fa7582..01ed836 100644 (file)
 (defvar *package-lock*)
 
 (!cold-init-forms
- (setf *package-lock* (sb!thread::make-spinlock :name "Package Lock")))
+ (setf *package-lock* (sb!thread:make-mutex :name "Package Lock")))
 
 (defmacro with-packages ((&key) &body forms)
-  `(sb!thread::with-recursive-spinlock (*package-lock*)
+  ;; FIXME: Since name conflicts can be signalled while holding the
+  ;; mutex, user code can be run leading to lock ordering problems.
+  ;;
+  ;; This used to be a spinlock, but there it can be held for a long
+  ;; time while the debugger waits for user input.
+  `(sb!thread:with-recursive-lock (*package-lock*)
      ,@forms))
 
 ;;; Make a package hashtable having a prime number of entries at least
index bf80f1b..b077674 100644 (file)
 (defmethod add-direct-method :around ((specializer specializer) method)
   ;; All the actions done under this lock are done in an order
   ;; that is safe to unwind at any point.
-  (sb-thread::with-recursive-spinlock (*specializer-lock*)
+  (sb-thread::with-recursive-system-spinlock (*specializer-lock*)
     (call-next-method)))
 
 (defmethod remove-direct-method :around ((specializer specializer) method)
   ;; All the actions done under this lock are done in an order
   ;; that is safe to unwind at any point.
-  (sb-thread::with-recursive-spinlock (*specializer-lock*)
+  (sb-thread::with-recursive-system-spinlock (*specializer-lock*)
     (call-next-method)))
 
 (defmethod add-direct-method ((specializer class) (method method))
index 1bfc001..7382e83 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.25.50"
+"1.0.25.51"