proxy-wasm-cpp-host icon indicating copy to clipboard operation
proxy-wasm-cpp-host copied to clipboard

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

Open mathetake opened this issue 4 years ago • 2 comments

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

mathetake avatar Aug 21 '21 01:08 mathetake

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.

PiotrSikora avatar Aug 21 '21 06:08 PiotrSikora

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.

mathetake avatar Aug 25 '21 07:08 mathetake