diff --git a/.github/workflows/job-unit-tests.yml b/.github/workflows/job-unit-tests.yml index ed97be703..7f8f6a1ce 100644 --- a/.github/workflows/job-unit-tests.yml +++ b/.github/workflows/job-unit-tests.yml @@ -124,7 +124,7 @@ jobs: sudo bash -c 'echo "${{ github.workspace }}/coredumps/%e.%p.%t" > /proc/sys/kernel/core_pattern' - run: make setup - run: make - - name: Run make test + - name: Run tests run: | ulimit -c unlimited make test diff --git a/src/common/lua/ngx_wasm_lua.c b/src/common/lua/ngx_wasm_lua.c index 3c87d8491..6c92b56a6 100644 --- a/src/common/lua/ngx_wasm_lua.c +++ b/src/common/lua/ngx_wasm_lua.c @@ -604,7 +604,6 @@ ngx_wasm_lua_thread_run(ngx_wasm_lua_ctx_t *lctx) ngx_int_t ngx_wasm_lua_resume(ngx_wasm_subsys_env_t *env) { - size_t i; ngx_int_t rc; ngx_queue_t *q; ngx_http_lua_ctx_t *ctx; diff --git a/src/common/lua/ngx_wasm_lua_resolver.c b/src/common/lua/ngx_wasm_lua_resolver.c index d95ce69ac..a71600853 100644 --- a/src/common/lua/ngx_wasm_lua_resolver.c +++ b/src/common/lua/ngx_wasm_lua_resolver.c @@ -57,7 +57,7 @@ static const char *DNS_SOLVING_SCRIPT = "" " 'nameserver ' .. nameserver, \n" " 'options timeout:' .. timeout, \n" " }, \n" - " noSynchronisation = true, \n" + " --noSynchronisation = true, \n" " }) \n" " if not ok then \n" " error(fmt('wasm lua failed initializing dns_client ' .. \n" diff --git a/src/common/proxy_wasm/ngx_proxy_wasm.c b/src/common/proxy_wasm/ngx_proxy_wasm.c index 2eb3e872e..2e4861019 100644 --- a/src/common/proxy_wasm/ngx_proxy_wasm.c +++ b/src/common/proxy_wasm/ngx_proxy_wasm.c @@ -897,6 +897,8 @@ ngx_proxy_wasm_dispatch_calls_total(ngx_proxy_wasm_exec_t *pwexec) q != ngx_queue_sentinel(&pwexec->calls); q = ngx_queue_next(q), n++) { /* void */ } + dd("n: %ld", n); + return n; } diff --git a/src/http/ngx_http_wasm_module.c b/src/http/ngx_http_wasm_module.c index ab47a2421..93b89b424 100644 --- a/src/http/ngx_http_wasm_module.c +++ b/src/http/ngx_http_wasm_module.c @@ -768,7 +768,6 @@ ngx_http_wasm_rewrite_handler(ngx_http_request_t *r) break; default: ngx_wa_assert(rc == NGX_ERROR); - rc = NGX_HTTP_INTERNAL_SERVER_ERROR; goto done; } #endif @@ -1075,6 +1074,30 @@ ngx_http_wasm_content_handler(ngx_http_request_t *r) rctx->entered_content_phase = 1; +#if (NGX_WASM_LUA) + /* Lua yield in previous content may have replaced + * r->write_event_handler with ngx_http_core_run_phases; force + * our lua thread resume */ + rc = ngx_wasm_lua_resume(&rctx->env); + dd("wasm lua resume rc: %ld", rc); + switch (rc) { + case NGX_AGAIN: + if (r == r->main) { + r->main->count++; + dd("r->main->count++: %d", r->main->count); + rc = NGX_DONE; + } + + goto done; + case NGX_OK: + break; + default: + ngx_wa_assert(rc == NGX_ERROR); + rc = NGX_HTTP_INTERNAL_SERVER_ERROR; + goto done; + } +#endif + rc = ngx_http_wasm_content(rctx); done: diff --git a/t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t b/t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t index 01e0cc698..eb0343f13 100644 --- a/t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t +++ b/t/04-openresty/lua-bridge/002-proxy_wasm_lua_resolver_sanity.t @@ -777,8 +777,7 @@ ok echo ok; } --- request -GET /t - +POST /t Hello world --- response_headers_like pwm-call-id: \d, \d, \d, \d diff --git a/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs b/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs index 783432b53..7e992e757 100644 --- a/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs +++ b/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs @@ -173,7 +173,6 @@ impl RootContext for TestRoot { config: self.config.clone(), on_phases: phases, n_sync_calls: 0, - ncalls: 0, })) } } diff --git a/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs b/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs index 5c3bf0f7b..ace8a7381 100644 --- a/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs +++ b/t/lib/proxy-wasm-tests/hostcalls/src/types/test_http.rs @@ -7,7 +7,6 @@ pub struct TestHttp { pub on_phases: Vec, pub config: HashMap, pub n_sync_calls: usize, - pub ncalls: usize, } impl TestHttp {