From: Nikodemus Siivola Date: Mon, 6 Oct 2008 09:34:55 +0000 (+0000) Subject: 1.0.21.8: SERVE-EVENT error handling X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=f251802ba07257a9b3a23eca02cfd89ad9d6e6b9;p=sbcl.git 1.0.21.8: SERVE-EVENT error handling * 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.) --- diff --git a/NEWS b/NEWS index d0619b8..20778e6 100644 --- 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 diff --git a/src/code/serve-event.lisp b/src/code/serve-event.lisp index b1b8aaf..00e3dec 100644 --- a/src/code/serve-event.lisp +++ b/src/code/serve-event.lisp @@ -119,19 +119,20 @@ (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) @@ -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) diff --git a/tools-for-build/grovel-headers.c b/tools-for-build/grovel-headers.c index 4fb9345..56069ae 100644 --- a/tools-for-build/grovel-headers.c +++ b/tools-for-build/grovel-headers.c @@ -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); diff --git a/version.lisp-expr b/version.lisp-expr index b8c236a..c5c4020 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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"