From eb13e451dd8d0ed08acdf2f743a506daad3b43f0 Mon Sep 17 00:00:00 2001 From: Thibault Charbonnier Date: Tue, 19 Nov 2024 12:03:42 -0800 Subject: [PATCH] feat(proxy-wasm) implement 'proxy_wasm_log_dispatch_errors' directive --- docs/DIRECTIVES.md | 66 +++++++--- src/http/ngx_http_wasm.h | 8 +- src/http/ngx_http_wasm_module.c | 50 +++++-- .../proxy_wasm/ngx_http_proxy_wasm_dispatch.c | 6 +- src/wasm/ngx_wasm.h | 1 + src/wasm/ngx_wasm_core_module.c | 22 +++- .../hfuncs/131-proxy_dispatch_http_timeouts.t | 124 +++++++++++++++++- t/lib/proxy-wasm-tests/hostcalls/src/lib.rs | 6 + 8 files changed, 232 insertions(+), 51 deletions(-) diff --git a/docs/DIRECTIVES.md b/docs/DIRECTIVES.md index f19fb9be7..914836844 100644 --- a/docs/DIRECTIVES.md +++ b/docs/DIRECTIVES.md @@ -10,6 +10,7 @@ By alphabetical order: - [module](#module) - [proxy_wasm](#proxy_wasm) - [proxy_wasm_isolation](#proxy_wasm_isolation) +- [proxy_wasm_log_dispatch_errors](#proxy_wasm_log_dispatch_errors) - [proxy_wasm_lua_resolver](#proxy_wasm_lua_resolver) - [proxy_wasm_request_headers_in_access](#proxy_wasm_request_headers_in_access) - [resolver](#resolver) @@ -45,6 +46,8 @@ By context: - [compiler](#compiler) - [backtraces](#backtraces) - [module](#module) + - [proxy_wasm_log_dispatch_errors](#proxy_wasm_log_dispatch_errors) + - [proxy_wasm_lua_resolver](#proxy_wasm_lua_resolver) - [resolver](#resolver) - [resolver_timeout](#resolver_timeout) - [shm_kv](#shm_kv) @@ -72,6 +75,7 @@ By context: - `http{}`, `server{}`, `location{}` - [proxy_wasm](#proxy_wasm) - [proxy_wasm_isolation](#proxy_wasm_isolation) + - [proxy_wasm_log_dispatch_errors](#proxy_wasm_log_dispatch_errors) - [proxy_wasm_lua_resolver](#proxy_wasm_lua_resolver) - [proxy_wasm_request_headers_in_access](#proxy_wasm_request_headers_in_access) - [resolver_add](#resolver_add) @@ -260,7 +264,7 @@ Load a Wasm module from disk. - `path` must point to a bytecode file whose format is `.wasm` (binary) or `.wat` (text). - `config` is an optional configuration string passed to `on_vm_start` when - `module` is a proxy-wasm filter. + `module` is a Proxy-Wasm filter. If successfully loaded, the module can later be referred to by `name`. @@ -286,11 +290,11 @@ proxy_wasm **default** | **example** | `proxy_wasm my_filter_module 'foo=bar';` -Add a proxy-wasm filter to the context's execution chain (see [Execution +Add a Proxy-Wasm filter to the context's execution chain (see [Execution Chain]). - `module` must be a Wasm module name declared by a [module](#module) directive. - This module must be a valid proxy-wasm filter. + This module must be a valid Proxy-Wasm filter. - `config` is an optional configuration string passed to the filter's `on_configure` phase. @@ -305,25 +309,25 @@ start. > Notes Each instance of the `proxy_wasm` directive in the configuration will be -represented by a proxy-wasm root filter context in a Wasm instance. +represented by a Proxy-Wasm root filter context in a Wasm instance. All root filter contexts of the same module share the same instance. All root filter contexts will be initialized during nginx worker process initialization, which will invoke the filters' `on_vm_start` and `on_configure` phases. Each root context may optionally start a single background tick, as -specified by the [proxy-wasm SDK](#proxy-wasm). +specified by the [Proxy-Wasm SDK](#proxy-wasm). Note that when the master process is in use as a daemon (default Nginx configuration), the `nginx` exit code may be `0` when its worker processes fail -initialization. Since proxy-wasm filters are started on a per-process basis, +initialization. Since Proxy-Wasm filters are started on a per-process basis, filter initialization takes place (and may fail) during worker process initialization, which will be reflected in the error logs. On incoming HTTP requests traversing the context (see [Contexts]), the [Execution Chain] will resume execution for the current Nginx phase, which will -cause each configured filter to resume its corresponding proxy-wasm phase. Each -request gets associated with a proxy-wasm HTTP filter context, and a Wasm +cause each configured filter to resume its corresponding Proxy-Wasm phase. Each +request gets associated with a Proxy-Wasm HTTP filter context, and a Wasm instance to execute into. HTTP filter contexts can execute on instances with various lifecycles and @@ -341,13 +345,13 @@ proxy_wasm_isolation **default** | `none` **example** | `proxy_wasm_isolation stream;` -Select the Wasm instance isolation mode for proxy-wasm filters. +Select the Wasm instance isolation mode for Proxy-Wasm filters. - `isolation` must be one of `none`, `stream`, `filter`. > Notes -Each proxy-wasm filter within the context's [Execution Chain] will be given an +Each Proxy-Wasm filter within the context's [Execution Chain] will be given an instance to execute onto. The lifecycle and isolation of that instance depend on the chosen `isolation` mode: @@ -359,16 +363,40 @@ the chosen `isolation` mode: [Back to TOC](#directives) +proxy_wasm_log_dispatch_errors +------------------------------ + +**usage** | `proxy_wasm_log_dispatch_errors ;` +------------:|:---------------------------------------------------------------- +**contexts** | `wasm{}`, `http{}`, `server{}`, `location{}` +**default** | `on` +**example** | `proxy_wasm_log_dispatch_errors off;` + +Toggles TCP socket error logs on Proxy-Wasm dispatch calls failure. + +When enabled, an `[error]` log will be produced on failure conditions such as +timeout, broken connection, resolver failure, etc. + +When used in the `wasm{}` context, this directive has a global effect on all +`location{}` contexts (unless overridden) as well as root Proxy-Wasm dispatch +calls. + +[Back to TOC](#directives) + proxy_wasm_lua_resolver ----------------------- **usage** | `proxy_wasm_lua_resolver ;` ------------:|:---------------------------------------------------------------- -**contexts** | `http{}`, `server{}`, `location{}` +**contexts** | `wasm{}`, `http{}`, `server{}`, `location{}` **default** | `off` **example** | `proxy_wasm_lua_resolver on;` -Toggles the "Lua DNS resolver for proxy-wasm" feature within the context. +Toggles the "Lua DNS resolver for Proxy-Wasm" feature within the context. + +When used in the `wasm{}` context, this directive has a global effect on all +`location{}` contexts (unless overridden) as well as root Proxy-Wasm dispatch +calls. **Note:** this directive requires Lua support and will only have an effect if ngx_wasm_module was compiled alongside [OpenResty]. @@ -389,7 +417,7 @@ If not, a default client instance will be created pointing to `8.8.8.8` with a timeout value of `30s`. When in use, any [resolver] directive in the effective context will be ignored -for proxy-wasm HTTP dispatches. +for Proxy-Wasm HTTP dispatches. [Back to TOC](#directives) @@ -431,7 +459,7 @@ This directive's arguments are identical to Nginx's [resolver] directive. Wasm sockets usually rely on the configured Nginx [resolver] to resolve hostname. However, some contexts do not support a [resolver] yet still provide -access to Wasm sockets (e.g. proxy-wasm's `on_vm_start` or `on_tick`). In such +access to Wasm sockets (e.g. Proxy-Wasm's `on_vm_start` or `on_tick`). In such contexts, the global `wasm{}` resolver will be used. The global resolver is also used as a fallback if no resolver is configured in @@ -525,7 +553,7 @@ start. Shared memory zones are shared between all nginx worker processes, and serve as a means of storage and exchange for worker processes of a server instance. -Shared key/value memory zones can be used via the [proxy-wasm +Shared key/value memory zones can be used via the [Proxy-Wasm SDK](#proxy-wasm)'s `[get\|set]_shared_data` API. [Back to TOC](#directives) @@ -557,7 +585,7 @@ start. Shared memory zones are shared between all nginx worker processes, and serve as a means of storage and exchange for worker processes of a server instance. -Shared queue memory zones can be used via the [proxy-wasm SDK](#proxy-wasm)'s +Shared queue memory zones can be used via the [Proxy-Wasm SDK](#proxy-wasm)'s `[enqueue\|dequeue]_shared_queue` API. **Note:** shared memory queues do not presently implement an automatic eviction @@ -663,7 +691,7 @@ This directive is effective for all Wasm sockets in all contexts. > Notes -When using the [proxy-wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a +When using the [Proxy-Wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a `timeout` argument can be specified which will override this setting. For configuring Wasm sockets in `http{}` contexts, see @@ -708,7 +736,7 @@ Set a default timeout value for Wasm sockets read operations. > Notes -When using the [proxy-wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a +When using the [Proxy-Wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a `timeout` argument can be specified which will override this setting. For configuring Wasm sockets in `http{}` contexts, see @@ -729,7 +757,7 @@ Set a default timeout value for Wasm sockets send operations. > Notes -When using the [proxy-wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a +When using the [Proxy-Wasm SDK](#proxy-wasm) `dispatch_http_call()` method, a `timeout` argument can be specified which will override this setting. For configuring Wasm sockets in `http{}` contexts, see diff --git a/src/http/ngx_http_wasm.h b/src/http/ngx_http_wasm.h index bd65db193..4c2f68f28 100644 --- a/src/http/ngx_http_wasm.h +++ b/src/http/ngx_http_wasm.h @@ -79,6 +79,7 @@ struct ngx_http_wasm_req_ctx_s { unsigned ffi_attached:1; unsigned pwm_lua_resolver:1; /* use Lua-land resolver in OpenResty */ + unsigned pwm_log_dispatch_errors:1; }; @@ -95,12 +96,13 @@ typedef struct { ngx_bufs_t socket_large_buffers; /* wasm_socket_large_buffer_size */ ngx_bufs_t resp_body_buffers; /* wasm_response_body_buffers */ - ngx_flag_t pwm_req_headers_in_access; - ngx_flag_t pwm_lua_resolver; - ngx_flag_t postpone_rewrite; ngx_flag_t postpone_access; + ngx_flag_t pwm_req_headers_in_access; + ngx_flag_t pwm_lua_resolver; + ngx_flag_t pwm_log_dispatch_errors; + ngx_queue_t q; /* main_conf */ } ngx_http_wasm_loc_conf_t; diff --git a/src/http/ngx_http_wasm_module.c b/src/http/ngx_http_wasm_module.c index bbaace230..53033496d 100644 --- a/src/http/ngx_http_wasm_module.c +++ b/src/http/ngx_http_wasm_module.c @@ -116,6 +116,8 @@ ngx_wasm_subsystem_t ngx_http_wasm_subsystem = { static ngx_command_t ngx_http_wasm_module_cmds[] = { + /* wasm */ + { ngx_string("wasm_call"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE3, ngx_http_wasm_call_directive, @@ -172,6 +174,22 @@ static ngx_command_t ngx_http_wasm_module_cmds[] = { offsetof(ngx_http_wasm_loc_conf_t, resp_body_buffers), NULL }, + { ngx_string("wasm_postpone_rewrite"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_wasm_loc_conf_t, postpone_rewrite), + NULL }, + + { ngx_string("wasm_postpone_access"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_wasm_loc_conf_t, postpone_access), + NULL }, + + /* proxy_wasm */ + { ngx_string("proxy_wasm"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE12, ngx_http_wasm_proxy_wasm_directive, @@ -186,13 +204,6 @@ static ngx_command_t ngx_http_wasm_module_cmds[] = { NGX_HTTP_MODULE, NULL }, - { ngx_string("resolver_add"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, - ngx_http_wasm_resolver_add_directive, - NGX_HTTP_LOC_CONF_OFFSET, - NGX_HTTP_MODULE, - NULL }, - { ngx_string("proxy_wasm_request_headers_in_access"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_flag_slot, @@ -207,18 +218,20 @@ static ngx_command_t ngx_http_wasm_module_cmds[] = { offsetof(ngx_http_wasm_loc_conf_t, pwm_lua_resolver), NULL }, - { ngx_string("wasm_postpone_rewrite"), + { ngx_string("proxy_wasm_log_dispatch_errors"), NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, ngx_conf_set_flag_slot, NGX_HTTP_LOC_CONF_OFFSET, - offsetof(ngx_http_wasm_loc_conf_t, postpone_rewrite), + offsetof(ngx_http_wasm_loc_conf_t, pwm_log_dispatch_errors), NULL }, - { ngx_string("wasm_postpone_access"), - NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, - ngx_conf_set_flag_slot, + /* misc */ + + { ngx_string("resolver_add"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2, + ngx_http_wasm_resolver_add_directive, NGX_HTTP_LOC_CONF_OFFSET, - offsetof(ngx_http_wasm_loc_conf_t, postpone_access), + NGX_HTTP_MODULE, NULL }, ngx_null_command @@ -340,6 +353,7 @@ ngx_http_wasm_create_loc_conf(ngx_conf_t *cf) loc->socket_buffer_reuse = NGX_CONF_UNSET; loc->pwm_req_headers_in_access = NGX_CONF_UNSET; loc->pwm_lua_resolver = NGX_CONF_UNSET; + loc->pwm_log_dispatch_errors = NGX_CONF_UNSET; loc->postpone_rewrite = NGX_CONF_UNSET; loc->postpone_access = NGX_CONF_UNSET; @@ -404,6 +418,9 @@ ngx_http_wasm_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) ngx_conf_merge_value(conf->pwm_lua_resolver, prev->pwm_lua_resolver, 0); + ngx_conf_merge_value(conf->pwm_log_dispatch_errors, + prev->pwm_log_dispatch_errors, 1); + ngx_conf_merge_value(conf->postpone_rewrite, prev->postpone_rewrite, NGX_CONF_UNSET); @@ -636,10 +653,17 @@ ngx_http_wasm_rctx(ngx_http_request_t *r, ngx_http_wasm_req_ctx_t **out) rctx->pwm_lua_resolver = loc->pwm_lua_resolver != NGX_CONF_UNSET ? loc->pwm_lua_resolver : wcf ? wcf->pwm_lua_resolver : 0; + rctx->pwm_log_dispatch_errors = loc->pwm_log_dispatch_errors + != NGX_CONF_UNSET + ? loc->pwm_log_dispatch_errors + : wcf ? wcf->pwm_log_dispatch_errors : 0; } else { /* fake request */ rctx->pwm_lua_resolver = wcf ? wcf->pwm_lua_resolver : 0; + rctx->pwm_log_dispatch_errors = wcf + ? wcf->pwm_log_dispatch_errors + : 0; } } #if (NGX_DEBUG) diff --git a/src/http/proxy_wasm/ngx_http_proxy_wasm_dispatch.c b/src/http/proxy_wasm/ngx_http_proxy_wasm_dispatch.c index 4812cd1b2..b0cdb9b6b 100644 --- a/src/http/proxy_wasm/ngx_http_proxy_wasm_dispatch.c +++ b/src/http/proxy_wasm/ngx_http_proxy_wasm_dispatch.c @@ -144,8 +144,10 @@ ngx_http_proxy_wasm_dispatch_err(ngx_http_proxy_wasm_dispatch_t *call, #endif if (!pwexec->ictx->instance->hostcall || rctx->fake_request) { - ngx_wasm_log_error(NGX_LOG_ERR, pwexec->log, 0, - "%*s", p - (u_char *) &errbuf, &errbuf); + if (rctx->pwm_log_dispatch_errors) { + ngx_wasm_log_error(NGX_LOG_ERR, pwexec->log, 0, "%*s", + p - (u_char *) &errbuf, &errbuf); + } } else { /* in-vm, executing a hostcall */ diff --git a/src/wasm/ngx_wasm.h b/src/wasm/ngx_wasm.h index db8d2986f..e19f703b3 100644 --- a/src/wasm/ngx_wasm.h +++ b/src/wasm/ngx_wasm.h @@ -101,6 +101,7 @@ typedef struct { ngx_resolver_t *user_resolver; ngx_flag_t pwm_lua_resolver; + ngx_flag_t pwm_log_dispatch_errors; } ngx_wasm_core_conf_t; diff --git a/src/wasm/ngx_wasm_core_module.c b/src/wasm/ngx_wasm_core_module.c index 1b6dca923..6d96aecf7 100644 --- a/src/wasm/ngx_wasm_core_module.c +++ b/src/wasm/ngx_wasm_core_module.c @@ -166,13 +166,6 @@ static ngx_command_t ngx_wasm_core_commands[] = { offsetof(ngx_wasm_core_conf_t, resolver_timeout), NULL }, - { ngx_string("proxy_wasm_lua_resolver"), - NGX_WASM_CONF|NGX_CONF_TAKE1, - ngx_wasm_core_pwm_lua_resolver_directive, - NGX_WA_WASM_CONF_OFFSET, - offsetof(ngx_wasm_core_conf_t, pwm_lua_resolver), - NULL }, - { ngx_string("socket_connect_timeout"), NGX_WASM_CONF|NGX_CONF_TAKE1, ngx_conf_set_msec_slot, @@ -215,6 +208,20 @@ static ngx_command_t ngx_wasm_core_commands[] = { offsetof(ngx_wasm_core_conf_t, socket_large_buffers), NULL }, + { ngx_string("proxy_wasm_lua_resolver"), + NGX_WASM_CONF|NGX_CONF_TAKE1, + ngx_wasm_core_pwm_lua_resolver_directive, + NGX_WA_WASM_CONF_OFFSET, + offsetof(ngx_wasm_core_conf_t, pwm_lua_resolver), + NULL }, + + { ngx_string("proxy_wasm_log_dispatch_errors"), + NGX_WASM_CONF|NGX_CONF_TAKE1, + ngx_conf_set_flag_slot, + NGX_WA_WASM_CONF_OFFSET, + offsetof(ngx_wasm_core_conf_t, pwm_log_dispatch_errors), + NULL }, + ngx_null_command }; @@ -364,6 +371,7 @@ ngx_wasm_core_create_conf(ngx_conf_t *cf) wcf->recv_timeout = NGX_CONF_UNSET_MSEC; wcf->pwm_lua_resolver = NGX_CONF_UNSET; + wcf->pwm_log_dispatch_errors = NGX_CONF_UNSET; wcf->socket_buffer_size = NGX_CONF_UNSET_SIZE; wcf->socket_buffer_reuse = NGX_CONF_UNSET; diff --git a/t/03-proxy_wasm/hfuncs/131-proxy_dispatch_http_timeouts.t b/t/03-proxy_wasm/hfuncs/131-proxy_dispatch_http_timeouts.t index 5d875d350..fb09f3f0b 100644 --- a/t/03-proxy_wasm/hfuncs/131-proxy_dispatch_http_timeouts.t +++ b/t/03-proxy_wasm/hfuncs/131-proxy_dispatch_http_timeouts.t @@ -41,15 +41,125 @@ ok --- error_log eval [ qr/(\[error\]|Uncaught RuntimeError|\s+).*?dispatch failed: tcp socket - timed out connecting to \".*?\"/, - qr/\*\d+ .*? on_http_call_response \(id: \d+, status: , headers: 0, body_bytes: 0/, - qr/dispatch_status: timeout/ + qr/on_http_call_response \(id: \d+, status: , headers: 0, body_bytes: 0/, + "dispatch_status: timeout" +] +--- no_error_log +[crit] + + + +=== TEST 2: proxy_wasm - dispatch_http_call() 'proxy_wasm_log_dispatch_errors off;' in location{} +Note: enabled in wasm{} (and by default), but disabled in location{} takes precedence. +--- timeout eval: $::ExtTimeout +--- load_nginx_modules: ngx_http_echo_module +--- main_config eval +qq{ + wasm { + proxy_wasm_log_dispatch_errors on; + module hostcalls $t::TestWasmX::crates/hostcalls.wasm; + } +} +--- config eval +qq{ + resolver $::ExtResolver ipv6=off; + resolver_timeout $::ExtTimeout; + + location /t { + proxy_wasm_log_dispatch_errors off; + wasm_socket_connect_timeout 1ms; + + proxy_wasm hostcalls 'test=/t/dispatch_http_call \ + host=google.com'; + echo ok; + } +} +--- response_body +ok +--- error_log eval +[ + qr/on_http_call_response \(id: \d+, status: , headers: 0, body_bytes: 0/, + "dispatch_status: timeout" +] +--- no_error_log +dispatch failed: tcp socket - timed out connecting to +[crit] + + + +=== TEST 3: proxy_wasm - dispatch_http_call() 'proxy_wasm_log_dispatch_errors off;' in wasm{} +--- timeout eval: $::ExtTimeout +--- load_nginx_modules: ngx_http_echo_module +--- main_config eval +qq{ + wasm { + proxy_wasm_log_dispatch_errors off; + module hostcalls $t::TestWasmX::crates/hostcalls.wasm; + } +} +--- config eval +qq{ + resolver $::ExtResolver ipv6=off; + resolver_timeout $::ExtTimeout; + + location /t { + proxy_wasm_log_dispatch_errors off; + wasm_socket_connect_timeout 1ms; + + proxy_wasm hostcalls 'test=/t/dispatch_http_call \ + host=google.com'; + echo ok; + } +} +--- response_body +ok +--- error_log eval +[ + qr/on_http_call_response \(id: \d+, status: , headers: 0, body_bytes: 0/, + "dispatch_status: timeout" +] +--- no_error_log +dispatch failed: tcp socket - timed out connecting to +[crit] + + + +=== TEST 4: proxy_wasm - dispatch_http_call() on_tick with 'proxy_wasm_log_dispatch_errors off;' in wasm{} +Note: needs proxy_wasm_lua_resolver as ipv6=off cannot be configured in default resolver. +--- skip_eval: 6: $::nginxV !~ m/nginx version: openresty/ +--- timeout eval: $::ExtTimeout +--- load_nginx_modules: ngx_http_echo_module +--- main_config eval +qq{ + wasm { + socket_connect_timeout 1ms; + proxy_wasm_lua_resolver on; + proxy_wasm_log_dispatch_errors off; + module hostcalls $t::TestWasmX::crates/hostcalls.wasm; + } +} +--- config + location /t { + proxy_wasm hostcalls 'tick_period=200 \ + on_tick=dispatch \ + host=google.com'; + echo ok; + } +--- wait: 1 +--- response_body +ok +--- error_log eval +[ + qr/on_root_http_call_response \(id: \d+, status: , headers: 0, body_bytes: 0/, + "dispatch_status: timeout" ] --- no_error_log +dispatch failed: tcp socket - timed out connecting to [crit] -=== TEST 2: proxy_wasm - dispatch_http_call() resolver timeout +=== TEST 5: proxy_wasm - dispatch_http_call() resolver timeout Using a non-local resolver --- load_nginx_modules: ngx_http_echo_module --- wasm_modules: hostcalls @@ -79,7 +189,7 @@ ok -=== TEST 3: proxy_wasm - dispatch_http_call() read timeout +=== TEST 6: proxy_wasm - dispatch_http_call() read timeout macOS: mockeagain NYI --- skip_eval: 4: $::osname =~ m/darwin/ --- load_nginx_modules: ngx_http_echo_module @@ -110,7 +220,7 @@ ok -=== TEST 4: proxy_wasm - dispatch_http_call() write timeout +=== TEST 7: proxy_wasm - dispatch_http_call() write timeout macOS: mockeagain NYI --- skip_eval: 4: $::osname =~ m/darwin/ --- load_nginx_modules: ngx_http_echo_module @@ -143,7 +253,7 @@ ok -=== TEST 5: proxy_wasm - dispatch_http_call() on_request_headers EAGAIN +=== TEST 8: proxy_wasm - dispatch_http_call() on_request_headers EAGAIN dispatch_http_call() EAGAIN local_response() EAGAIN --- load_nginx_modules: ngx_http_echo_module @@ -170,7 +280,7 @@ Hello world -=== TEST 6: proxy_wasm - dispatch_http_call() on_request_body EAGAIN +=== TEST 9: proxy_wasm - dispatch_http_call() on_request_body EAGAIN dispatch_http_call() EAGAIN local_response() EAGAIN --- load_nginx_modules: ngx_http_echo_module diff --git a/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs b/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs index 95f2a3e44..f5719536e 100644 --- a/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs +++ b/t/lib/proxy-wasm-tests/hostcalls/src/lib.rs @@ -214,10 +214,16 @@ impl Context for TestRoot { ntrailers: usize, ) { let status = self.get_http_call_response_header(":status"); + let dispatch_status = self.get_http_call_response_header(":dispatch_status"); info!( "[hostcalls] on_root_http_call_response (id: {}, status: {}, headers: {}, body_bytes: {}, trailers: {})", token_id, status.unwrap_or("".to_string()), nheaders, body_size, ntrailers ); + + match dispatch_status.as_deref() { + Some(s) => info!("dispatch_status: {}", s), + None => {} + } } }