proxy-wasm / proxy-wasm-cpp-host

WebAssembly for Proxies (C++ host implementation)
Apache License 2.0
84 stars 69 forks source link

on_vm_start is called multiple times when multiple plugins exist in a single VM. #192

Open mathetake opened 3 years ago

mathetake commented 3 years ago

WasmBase::start is called for every plugin;

https://github.com/proxy-wasm/proxy-wasm-cpp-host/blob/668bc99e4ead7872f014638ff16c68736853da43/src/wasm.cc#L593

and inside of it ContextBase::onStart is called:

https://github.com/proxy-wasm/proxy-wasm-cpp-host/blob/668bc99e4ead7872f014638ff16c68736853da43/src/wasm.cc#L395

that results in calling on_vm_start:

https://github.com/proxy-wasm/proxy-wasm-cpp-host/blob/668bc99e4ead7872f014638ff16c68736853da43/src/context.cc#L137-L142

PiotrSikora commented 3 years ago

I think it was done deliberately to retain some backward compatibility, since otherwise only on_vm_start from one plugin would be called, which might result in skipped global initializations, etc.

Having said that, do you have any use for this? I was thinking about completely removing on_vm_start (and vm_configuration) from the ABI, since everything should be scoped to plugins and their configuration.

mathetake commented 3 years ago

Having said that, do you have any use for this? I was thinking about completely removing on_vm_start (and vm_configuration) from the ABI, since everything should be scoped to plugins and their configuration.

actually I don't use this, and +1 to the idea that everything should be scoped to plugins. Btw what's your current thoughts on multiple plugins per 1 VM thing? That is somewhat related to that ABI change.