1.0.42.10: guard against time travel by getrusage()
authorNikodemus Siivola <nikodemus@random-state.net>
Tue, 31 Aug 2010 15:23:50 +0000 (15:23 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Tue, 31 Aug 2010 15:23:50 +0000 (15:23 +0000)
 * Fixes lp#544421, we hope.

 * Apparently sometimes getrusage() returns a smaller value on second
   call -- this seems to happen under pretty extreme loads, mostly --
   which we want to guard against.

NEWS
src/code/gc.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index e8dd9e7..b7fb281 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ changes relative to sbcl-1.0.42
     Josh Elsasser)
   * bug fix: using aliases for builtin classes as defmethod specializers
     without adding DEFTYPEs for them works. (lp#618387)
+  * bug fix: timetravel by getrusage() no longer causes type-errors during GC.
+    (lp#544421)
 
 changes in sbcl-1.0.42 relative to sbcl-1.0.41
   * build changes
index eb7f13d..042ab05 100644 (file)
@@ -224,8 +224,13 @@ run in any thread.")
                    (let ((start-time (get-internal-run-time)))
                      (collect-garbage gen)
                      (setf *gc-epoch* (cons nil nil))
-                     (incf *gc-run-time*
-                           (- (get-internal-run-time) start-time)))
+                     (let ((run-time (- (get-internal-run-time) start-time)))
+                       ;; KLUDGE: Sometimes we see the second getrusage() call
+                       ;; return a smaller value than the first, which can
+                       ;; lead to *GC-RUN-TIME* to going negative, which in
+                       ;; turn is a type-error.
+                       (when (plusp run-time)
+                         (incf *gc-run-time* run-time))))
                    (setf *gc-pending* nil
                          new-usage (dynamic-usage))
                    #!+sb-thread
index f49a576..133d606 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.42.9"
+"1.0.42.10"