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

Missing assert option #652

Open
dev-null-undefined opened this issue Dec 13, 2024 · 4 comments
Open

Missing assert option #652

dev-null-undefined opened this issue Dec 13, 2024 · 4 comments

Comments

@dev-null-undefined
Copy link
Contributor

If I am not mistaking the NGX_ABORT value is also valid for the rc here:

ngx_wa_assert(rc == NGX_OK /* step completed */

Since it can be returned from ngx_proxy_wasm_resume on wasmtime trap?
And after returning from this function you are also taking that value into count. So I think you forgot it here.

@thibaultcha
Copy link
Member

It does not seem true to me. On instance trap ngx_proxy_wasm_resume will return NGX_ERROR or NGX_HTTP_INTERNAL_SERVER_ERROR as per action2rc.

@dev-null-undefined
Copy link
Contributor Author

I am bit confused then by this if and others that are used whenever handling rc from ngx_wavm_instance_call_funcref

if (rc == NGX_ERROR || rc == NGX_ABORT) {

from there and many other places it seems to me like the value NGX_ABORT (-6) is allowed return value that is counted upon.

On that note from the assert (

|| rc == NGX_AGAIN /* step yielded */
)

I can see NGX_AGAIN being mentined as a way to yield a step?
But I can not find it anywhere else in the code.

@thibaultcha
Copy link
Member

A simple way to test return status codes is to add an assertion and run the whole test suite. When a test fails because of the assertion, you then know that you can isolate that specific test to further debug the case.

@thibaultcha
Copy link
Member

The first link in your comment (ngx_http_proxy_wasm.c) does need to cover NGX_ABORT because it calls the low-level ngx_wavm_instance_call_funcref which directly interacts with the Wasm VM. The second link is indeed for yielding which is communicated via a subsystem-agnostic state machine (env->state) see ngx_wasm_op_call_handler.

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

No branches or pull requests

2 participants