Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No format control for simple-error #92

Open
gibsonf1 opened this issue Sep 13, 2020 · 4 comments
Open

No format control for simple-error #92

gibsonf1 opened this issue Sep 13, 2020 · 4 comments

Comments

@gibsonf1
Copy link

gibsonf1 commented Sep 13, 2020

Although I'm running top-level handlers, this simple-error took down the server:

Sep 12 22:08:36 ip-10-0-0-168 trinity[1166]: 47.254.170.208 - [12/Sep/2020:23:08:36 -07:00] "GET /nice%20ports%2C/Tri%6Eity.txt%2ebak HTTP/1.0" 200 2897 "-" "-"
Sep 12 22:08:42 ip-10-0-0-168 trinity[1166]: Unhandled FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE in thread #<SB-THREAD:THREAD "woo-worker" RUNNING
Sep 12 22:08:42 ip-10-0-0-168 trinity[1166]:                                                            {1047C80A13}>:
Sep 12 22:08:42 ip-10-0-0-168 trinity[1166]:   Callback Error: the message-complete callback failed
Sep 12 22:08:42 ip-10-0-0-168 trinity[1166]:   #<error printing a WOO::INVALID-HTTP-VERSION: #<SIMPLE-ERROR "No format-control for ~S" {104B408C13}>>
Sep 12 22:08:42 ip-10-0-0-168 trinity[1166]: Backtrace for: #<SB-THREAD:THREAD "woo-worker" RUNNING {1047C80A13}>

I took a look at woo.lisp and see the code for this here:

(define-condition woo-error (simple-error) ())
(define-condition invalid-http-version (woo-error) ())

Would simply changing woo-error definition to this solve the problem:?

(define-condition woo-error (simple-error)
  ((description :initarg :description)
   (code :initarg :code
         :initform nil))
  (:report (lambda (condition stream)
             (with-slots (description code) condition
               (format stream
                       "~A~:[~;~:* (Code: ~A)~]"
                       description code)))))
@ghost
Copy link

ghost commented Sep 20, 2020

I have the same problem

;error on sbcl

debugger invoked on a FAST-HTTP.ERROR:CB-MESSAGE-COMPLETE in thread
#<THREAD "woo-worker" RUNNING {10054C0313}>:
  Callback Error: the message-complete callback failed
(A SIMPLE-ERROR was caught when trying to print *DEBUG-CONDITION* when entering
the debugger. Printing was aborted and the SIMPLE-ERROR was stored in
SB-DEBUG::*NESTED-DEBUG-CONDITION*.)

The current thread is not at the foreground,
SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD "main thread" RUNNING {1001560253}>
for this thread to enter the debugger.
;error on ccl

> Error: Callback Error: the message-complete callback failed
>          #<error printing INVALID-HTTP-VERSION #x302001FC565D>
> While executing: (:INTERNAL FAST-HTTP.PARSER::PARSE-BODY), in process woo-worker(4).                               


;;;
;;; #<PROCESS woo-worker(4) [Active] #x302001F5DA4D> requires access to Shared Terminal Input                        
;;; Type (:y 4) to yield control to this thread.
;;;

@gibsonf1
Copy link
Author

I'll do a pull request for this

@gibsonf1
Copy link
Author

#93

@TheJunglePedantic
Copy link

TheJunglePedantic commented Feb 8, 2022

i think maybe throw out the woo errors and use fast-http:invalid-version. the relevant error handling code only deals with fast-http:parsing-error conditions and even when you fix the format control report error for woo:simple-error, the server still crashes.


(import-from :fast-http
             ;;etc...
             :invalid-version)

(defun http-version-keyword (major minor)
  (unless (= major 1)
    (error 'fast-http:invalid-version))

  (case minor
    (1 :HTTP/1.1)
    (0 :HTTP/1.0)
    (otherwise (error 'fast-http:invalid-version))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants