Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip
Browse files Browse the repository at this point in the history
thibaultcha committed Oct 31, 2023
1 parent d0ad7ee commit 91bef11
Showing 2 changed files with 11 additions and 15 deletions.
20 changes: 8 additions & 12 deletions src/common/proxy_wasm/ngx_proxy_wasm.c
Original file line number Diff line number Diff line change
@@ -310,7 +310,9 @@ ngx_proxy_wasm_ctx_destroy(ngx_proxy_wasm_ctx_t *pwctx)

dd("enter (pwctx: %p)", pwctx);

if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_STREAM && pwctx->ready) {
if (pwctx->ready
&& pwctx->isolation == NGX_PROXY_WASM_ISOLATION_STREAM)
{
ngx_proxy_wasm_store_destroy(&pwctx->store);
}

@@ -336,9 +338,9 @@ ngx_proxy_wasm_ctx_destroy(ngx_proxy_wasm_ctx_t *pwctx)
if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_NONE) {
/* sweep if an instance has trapped */
ngx_proxy_wasm_store_sweep(pwexec->ictx->store);
}

if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_FILTER) {
} else if (pwctx->isolation == NGX_PROXY_WASM_ISOLATION_FILTER) {
/* destroy filter context store */
ngx_proxy_wasm_store_destroy(pwexec->store);
}
}
@@ -1089,9 +1091,7 @@ ngx_proxy_wasm_create_context(ngx_proxy_wasm_filter_t *filter,

if (id && (in == NULL || in->root_id != NGX_PROXY_WASM_ROOT_CTX_ID)) {
pwexec = ngx_proxy_wasm_lookup_ctx(ictx, id);

dd("pwexec for id %ld: %p", id, pwexec);

dd("pwexec for id %ld: %p (in: %p)", id, pwexec, in);
if (pwexec == NULL) {

if (in == NULL) {
@@ -1664,7 +1664,7 @@ static void
ngx_proxy_wasm_instance_invalidate(ngx_proxy_wasm_instance_t *ictx)
{
ngx_rbtree_node_t **root, **sentinel, *s, *n;
ngx_proxy_wasm_exec_t *pwexec = NULL;
ngx_proxy_wasm_exec_t *pwexec;

dd("enter (ictx: %p)", ictx);

@@ -1676,15 +1676,14 @@ ngx_proxy_wasm_instance_invalidate(ngx_proxy_wasm_instance_t *ictx)

while (*root != *sentinel) {
n = ngx_rbtree_min(*root, *sentinel);
#if 0
#if (DDEBUG)
pwexec = ngx_rbtree_data(n, ngx_proxy_wasm_exec_t, node);

dd("invalidate root ctx #%ld instance (pwexec: %p)",
pwexec->id, pwexec);
#endif

ngx_rbtree_delete(&ictx->root_ctxs, n);

#if 0
destroy_pwexec(pwexec);
#endif
@@ -1734,10 +1733,8 @@ ngx_proxy_wasm_instance_destroy(ngx_proxy_wasm_instance_t *ictx)
rexec = ngx_rbtree_data(n, ngx_proxy_wasm_exec_t, node);

rexec->ictx = NULL;
rexec->started = 0;

ngx_rbtree_delete(&ictx->root_ctxs, n);

#if 0
destroy_pwexec(rexec);
#endif
@@ -1754,7 +1751,6 @@ ngx_proxy_wasm_instance_destroy(ngx_proxy_wasm_instance_t *ictx)
ngx_wasm_assert(rexec->ev == NULL);

rexec->ictx = NULL;
rexec->started = 0;

ngx_rbtree_delete(&ictx->tree_ctxs, n);
}
6 changes: 3 additions & 3 deletions t/03-proxy_wasm/003-on_tick.t
Original file line number Diff line number Diff line change
@@ -166,14 +166,14 @@ Should not prevent http context/instance from starting
return 200;
}
--- response_body
--- grep_error_log eval: qr/\[(info|crit)].*?on_tick.*/
--- grep_error_log eval: qr/(\[crit\]|\[info].*?on_tick).*/
--- grep_error_log_out eval
qr/.*?
\[info\] .*? on_tick 200.*
\[crit\] .*? panicked at 'on_tick trap'.*
\[crit\] .*? panicked at.*
.*?
\[info\] .*? on_tick 200.*
\[crit\] .*? panicked at 'on_tick trap'.*/
\[crit\] .*? panicked at.*/
--- error_log
filter 1/1 resuming "on_request_headers" step
filter 1/1 resuming "on_response_headers" step

0 comments on commit 91bef11

Please sign in to comment.