Before instantiating filter chains and request contexts, filters themselves (i.e. their root context) are represented in the module. Eventually, ngx_proxy_wasm_start iterates over all filters to start their root contexts.
Previously, all filters declared in proxy_wasm directives were stored globally. With the introduction of the FFI filters can be dynamically added to the internal representation during proxy_wasm.load, which makes it possible for ngx_proxy_wasm_start to be invoked several times.
However, since the filters structure was global then all previously declared filters were started again, including filters that previously failed initializing their root contexts. This was not happening with proxy_wasm directives since a filter failing initialization in that case would not allow Nginx to start in the first place.
Now all filters are stored in a "filters root" structure which can divide filter root contexts as needed. Each worker has a global "worker filters root", and each ngx_wasm_ops_plan created by the FFI has its own isolated "filters root".
Before instantiating filter chains and request contexts, filters themselves (i.e. their root context) are represented in the module. Eventually,
ngx_proxy_wasm_start
iterates over all filters to start their root contexts.Previously, all filters declared in
proxy_wasm
directives were stored globally. With the introduction of the FFI filters can be dynamically added to the internal representation duringproxy_wasm.load
, which makes it possible forngx_proxy_wasm_start
to be invoked several times.However, since the filters structure was global then all previously declared filters were started again, including filters that previously failed initializing their root contexts. This was not happening with
proxy_wasm
directives since a filter failing initialization in that case would not allow Nginx to start in the first place.Now all filters are stored in a "filters root" structure which can divide filter root contexts as needed. Each worker has a global "worker filters root", and each
ngx_wasm_ops_plan
created by the FFI has its own isolated "filters root".