-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Currently, when a wasm bootstrap extension tries to make an http call, envoy will crash.
The reason for this crash, is that when wasm bootstrap extensions are initialized (here), the cluster manager is not yet initialized (that happens a bit further in the code, here) and is nullptr.
The confusing part is that clusterManager is returned by reference from ServerFactoryContext, implying that it cannot be nullptr.
An "easy" (non-)solution would be to move the bootstrap extension until after the cluster manager is initialized, but I think that would break the "default_socket_interface" feature.
A "hacky" solution is to wrap the createWasm call in WasmFactory::createBootstrapExtension (here) in a lambda, and post it to the dispatcher, to defer its execution. This way it should execute after the cluster manager is initialized (I didn't test this yet).
Would love to get some feedback on how to go about this before starting a PR, as the current "hacky" solution, a partialy initialized ServerFactoryContext still makes it into the bootstrap extension which is not ideal.
Another thought that comes to mind is to send the bootstrap extension a more minimal context object, and add another callback that's called once the cluster manager is initialized.
cc @EItanya