1.0.21.8: SERVE-EVENT error handling
authorNikodemus Siivola <nikodemus@random-state.net>
Mon, 6 Oct 2008 09:34:55 +0000 (09:34 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Mon, 6 Oct 2008 09:34:55 +0000 (09:34 +0000)
 * HANDLER-DESCRIPTORS-ERROR should not signal an error if there are
   no bad descriptors.

 * Check for EBADF and EINTR from select() explicitly, and inform the
   users of any other issues via SIMPLE-PERROR + CONTINUE restart. (We
   may be able to handle some others automatically as well, but let's
   figure out what occurs in the wild and why first.)

NEWS
src/code/serve-event.lisp
tools-for-build/grovel-headers.c
version.lisp-expr

diff --git a/NEWS b/NEWS
index d0619b8..20778e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ changes in sbcl-1.0.22 relative to 1.0.21:
     provided. (reported by Cedric St-Jean)
   * bug fix: circularity handling in the reader did not treat raw
     structure slots correctly. (reported by Cedric St-Jean)
+  * bug fix: SERVE-EVENT occasionally signaled an error about bogus
+    file descriptors when there were none.
 
 changes in sbcl-1.0.21 relative to 1.0.20:
   * new feature: the compiler is able to track the effective type of a
index b1b8aaf..00e3dec 100644 (file)
                   (sb!unix:unix-fstat (handler-descriptor handler)))
         (setf (handler-bogus handler) t)
         (push handler bogus-handlers)))
-    (restart-case (error "~S ~[have~;has a~:;have~] bad file descriptor~:P."
-                         bogus-handlers (length bogus-handlers))
-      (remove-them ()
-        :report "Remove bogus handlers."
-        (with-descriptor-handlers
-          (setf *descriptor-handlers*
-                (delete-if #'handler-bogus *descriptor-handlers*))))
-      (retry-them ()
-        :report "Retry bogus handlers."
-       (dolist (handler bogus-handlers)
-         (setf (handler-bogus handler) nil)))
-      (continue ()
-        :report "Go on, leaving handlers marked as bogus.")))
+    (when bogus-handlers
+      (restart-case (error "~S ~[have~;has a~:;have~] bad file descriptor~:P."
+                           bogus-handlers (length bogus-handlers))
+        (remove-them ()
+          :report "Remove bogus handlers."
+          (with-descriptor-handlers
+            (setf *descriptor-handlers*
+                  (delete-if #'handler-bogus *descriptor-handlers*))))
+        (retry-them ()
+          :report "Retry bogus handlers."
+          (dolist (handler bogus-handlers)
+            (setf (handler-bogus handler) nil)))
+        (continue ()
+          :report "Go on, leaving handlers marked as bogus."))))
   nil)
 
 \f
@@ -273,9 +274,14 @@ Shared between all threads, unless locally bound. EXPERIMENTAL.")
                ;; FIXME: Check for other errnos. Why do we return true
                ;; when interrupted?
                #!-win32
-               (if (eql err sb!unix:eintr)
-                   t
-                 (handler-descriptors-error))
+               (case err
+                 (#.sb!unix:ebadf
+                  (handler-descriptors-error))
+                 (#.sb!unix:eintr
+                  t)
+                 (otherwise
+                  (with-simple-restart (continue "Ignore failure and continue.")
+                    (simple-perror "Unix system call select() failed" :errno err))))
                #!+win32
                (handler-descriptors-error))
               ((plusp value)
index 4fb9345..56069ae 100644 (file)
@@ -305,6 +305,7 @@ main(int argc, char *argv[])
     printf("\n");
 
     printf(";;; error numbers\n");
+    deferrno("ebadf", EBADF);
     deferrno("enoent", ENOENT);
     deferrno("eintr", EINTR);
     deferrno("eio", EIO);
index b8c236a..c5c4020 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.21.7"
+"1.0.21.8"