Repository navigation
ubus fixes - #492
Merged
Merged
ubus fixes#492
Conversation
uc_ubus_call_user_cb() ran the completion callback of a defer() with a plain uc_vm_call(), unlike every other user callback, which goes through uc_ubus_vm_call(). An exception in that callback therefore bypassed the handler set with guard() and stayed pending in the VM. libubus runs the completion of a deferred request while any other request on the connection waits, so the exception then unwound that unrelated caller: a call() whose reply arrived returned no value and threw the callback's exception instead. Run the completion callback through uc_ubus_vm_call() as well. Signed-off-by: Felix Fietkau <nbd@nbd.name>
uc_ubus_vm_handle_exception() hands every exception of a user callback to the handler set with guard(), including the one that exit() raises. The call of the handler clears that exception, so the script keeps running: the handler receives an exception of type "Exit" and the event loop continues. Without a guard, the same exit() ends the process with the requested status. End the event loop and leave the exit request pending in the VM, the same as when no guard is set. uc_ubus_handle_reply_common() already keeps the exit() of a method handler away from the guard. Fixes: 693af2b ("ubus: add guard() function") Signed-off-by: Felix Fietkau <nbd@nbd.name>
Collaborator
|
Merged, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improve exception handling: