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
Wrong error handling flow on Lispworks #2
Comments
Hi Alexander,
I appreciate your contribution. I’m hardly Lisping right now but if you submit a push request I will take it. If you would like to have commit rights, that would be even better :-).
As far as printing a fuller report, just use describe. I.e., (describe lift:*test-result*)
HTH,
… On Dec 26, 2020, at 11:41 AM, Alexander Artemenko ***@***.***> wrote:
Using with-timeout on Lispworks I encounter strange behaviour when calling a code which signals an error.
From this simple code I expect it return NIL, but it shows debugger window instead:
CL-USER > (defun test-timeout ()
(ignore-errors
(trivial-timeout:with-timeout (3)
(error "Foo"))))
# It will show a dialog window about the error in the WITH-TIMEOUT process,
# and while you are deciding to open GUI debugger, window will be closed
# and result returned:
CL-USER > (ignore-errors (test-timeout))
NIL
#<COM.METABANG.TRIVIAL-TIMEOUT:TIMEOUT-ERROR 4020060D5B>
This happens because error is signed in a separate thread, not in the thread where I use ignore-errors.
The same code on SBCL behaves as expected.
I've tested different ways how to overcome this issue and created this code:
(defun run-with-interrupt (timeout func &rest args)
(let ((main (mp:get-current-process))
(done nil))
(mp:process-run-function "killer" ()
(lambda ()
(mp:process-wait-with-timeout "waiting for murder" timeout)
(mp:process-interrupt main
(lambda ()
(unless done
(cerror "Timeout" 'trivial-timeout:timeout-error))))))
(handler-bind ((error (lambda (c)
(declare (ignore c))
(setf done t))))
(multiple-value-prog1
(apply func args)
(setf done t)))))
It also starts a separate thread but it only tracks timeout and interrupts the main thread in case of errors. This way, error handling works like expected.
@gwkkwg <https://github.com/gwkkwg> if you OK with such code, I'll reformat it into the generate-platform-specific-code function and will create a pull-request.
Also, it would be nice if you tell me how to how to generate a report for unit-tests, because right now one of two tests fails on SBCL and Lispworks, but I can't figure out why:
CL-USER 82 > (lift:run-tests)
Start: TRIVIAL-TIMEOUT-TEST
#<Results for TRIVIAL-TIMEOUT-TEST 1 Test, 1 Error>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#2>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABHOIBFG2PCTYULOL2OBA3SWYG5FANCNFSM4VKBH7QA>.
|
Yes, this would be nice. I can maintain this library. |
Hi, @gwkkwg! Finally I found the time to fix this bug and created these two pulls:
Please, review them! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using
with-timeout
on Lispworks I encounter strange behaviour when calling a code which signals an error.From this simple code I expect it return NIL, but it shows debugger window instead:
This happens because
error
is signalled in a separate thread, not in the thread where I useignore-errors
.The same code on SBCL behaves as expected.
I've tested different ways how to overcome this issue and created this code:
It also starts a separate thread but it only tracks timeout and interrupts the main thread in case of errors. This way, error handling works like expected.
@gwkkwg if you OK with such code, I'll reformat it into the
generate-platform-specific-code
function and will create a pull-request.Also, it would be nice if you tell me how to how to generate a report for unit-tests, because right now one of two tests fails on SBCL and Lispworks, but I can't figure out why:
The text was updated successfully, but these errors were encountered: