[hunchentoot-devel] Hard to catch errors below process-request

AVS lispercat at gmail.com
Fri Jan 21 23:45:35 UTC 2011


Now it displays on the web page:
Internal Server Error
An error has occured
If  (setf hunchentoot:*handle-http-errors-p* nil) it just says "An
error has occured". Still doesn't trigger the debugger when (setf
*catch-errors-p* nil).
Also now the error is logged if *message-log-pathname* is specified.
Great progress! Can we still have the debugger triggered?

Thank you,
Andrew

On Fri, Jan 21, 2011 at 5:34 PM, Hans Hübner <hans.huebner at gmail.com> wrote:
> I prepared a patch to improve Hunchentoot's error handling for errors
> that occur in START-OUTPUT.  Please review
> http://bknr.net/trac/changeset/4637/trunk, update from
> svn+ssh://bknr.net/svn/ediware and try it out.
>
> Thanks!
> Hans
>
> On Fri, Jan 21, 2011 at 10:34 PM, Hans Hübner <hans.huebner at gmail.com> wrote:
>> Hi Andrei,
>>
>> thank you for sending the reproduction script.  Fixing the problem in
>> a satisfactory fashion requires some refactoring that'll take me some
>> time and require review.  I'll keep you posted.
>>
>> -Hans
>>
>> On Fri, Jan 21, 2011 at 5:15 PM, AVS <lispercat at gmail.com> wrote:
>>> Here is the standalone file to reproduce the unicode failure problem
>>> on my system (for the code below, put your path to quicklisp and save
>>> the code in a test.lisp file ):
>>> Load the file (for sbcl it's "sbcl --load test.lisp"), run lynx and
>>> type in "lynx 127.0.0.1:1234/test.html". It should give you an empty
>>> page.
>>>
>>> ;;test.lisp
>>> (load "/your-path/quicklisp/setup.lisp")
>>> (ql:quickload "hunchentoot")
>>>
>>> (defpackage :test
>>>  (:use :cl :hunchentoot))
>>>
>>> (in-package :test)
>>>
>>> (defparameter *server* (hunchentoot:start (make-instance
>>> 'hunchentoot:acceptor :port 1234)))
>>> (hunchentoot:define-easy-handler (test :uri "/test.html") (name)
>>>  (coerce '(#\RIGHT_DOUBLE_QUOTATION_MARK #\t #\e #\s #\t
>>> #\RIGHT_DOUBLE_QUOTATION_MARK) 'string))
>>> ;;file end
>>>
>>> Thank you,
>>> Andrei
>>>
>>>
>>> On Fri, Jan 21, 2011 at 5:05 AM, Hans Hübner <hans.huebner at gmail.com> wrote:
>>>> Harak, Andrei,
>>>>
>>>> I had a look at the relevant positions in the Hunchentoot source and
>>>> would be interested in solving the problem so that errors are
>>>> reported, rather than swallowed, without requiring the user to set up
>>>> special handlers.  My time is limited, though, so if you could help me
>>>> by providing an executable test case that exposes the problem, it´d be
>>>> greatly appreciated.
>>>>
>>>> Thanks,
>>>> Hans
>>>>
>>>> On Fri, Jan 21, 2011 at 10:48 AM, Phil Marneweck <haragx at gmail.com> wrote:
>>>>> On Fri, 2011-01-21 at 06:40 +0100, Hans Hübner wrote:
>>>>>
>>>>> On Fri, Jan 21, 2011 at 4:29 AM, AVS <lispercat at gmail.com> wrote:
>>>>>> Thank you for the suggestion, Hans.
>>>>>> In the mean time could you try one thing? Put some bad code inside
>>>>>> start-output that will cause an exception (for instance (list a b)
>>>>>> without a, b defined, or (/ 1 0)). Also (setf *catch-errors-p* nil).
>>>>>> If things are as they should be it'll trigger the debugger. In my case
>>>>>> it doesn't which is the cause of the whole issue.
>>>>>> If it triggers the debugger break for you, it means there is something
>>>>>> related to sbcl I am using.
>>>>>
>>>>> The debugger is not triggered, so the bug is real.  Having a way to
>>>>> reproduce it by user code would be helpful nevertheless.
>>>>>
>>>>> -Hans
>>>>>
>>>>>
>>>>> Like following?
>>>>>
>>>>> (defpackage :test
>>>>>   (:nicknames :test )
>>>>>   (:use :cl :hunchentoot :cl-who) )
>>>>>
>>>>>
>>>>> (in-package :test)
>>>>>
>>>>> ;;(hunchentoot:start (make-instance 'hunchentoot:acceptor :port 1111 ))
>>>>>
>>>>>
>>>>> (hunchentoot::define-easy-handler  (eish :uri "/eish.html"
>>>>> :default-request-type :both)
>>>>> ()
>>>>>    (cl-who::with-html-output-to-string (*standard-output* nil :indent t)
>>>>>      (cl-who::str "Hello World  XXX")))
>>>>>
>>>>>
>>>>> (defmacro with-debugging (&body body)
>>>>>   ;; Using this as debugging tool because hunchentoot
>>>>>   ;; swallows all errors here.
>>>>>   `(handler-bind ((error #'invoke-debugger))
>>>>>      , at body))
>>>>>
>>>>> (defclass xxx ()
>>>>>   ((ccc)) )
>>>>>
>>>>>
>>>>> (defmethod handle-request :before ((*acceptor* hunchentoot::acceptor)
>>>>> (*request* hunchentoot::request))
>>>>>
>>>>> ; (with-debugging
>>>>>    (slot-value (make-instance 'xxx) 'xxx)
>>>>> ;)
>>>>> )
>>>>>
>>>>> Harag
>>>>> _______________________________________________
>>>>> tbnl-devel site list
>>>>> tbnl-devel at common-lisp.net
>>>>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>>>>
>>>>
>>>> _______________________________________________
>>>> tbnl-devel site list
>>>> tbnl-devel at common-lisp.net
>>>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>>>
>>>
>>> _______________________________________________
>>> tbnl-devel site list
>>> tbnl-devel at common-lisp.net
>>> http://common-lisp.net/mailman/listinfo/tbnl-devel
>>>
>>
>
> _______________________________________________
> tbnl-devel site list
> tbnl-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/tbnl-devel
>




More information about the Tbnl-devel mailing list