Node.js runtimes based on -alpine might not handle signals
solsson opened this issue · comments
I haven't tested this yet but I noticed that we use a #!/bin/sh
script in the Node 4 runtime. In my experience that prevents shutdown signals from reaching the actual process. We could apk add bash
and change the shebang. Using -alpine is probably preferred over -stretch because we build with kaniko that unpacks everything.
Basically, node 4 runtime is my shame. If I had a little knowledge of nodejs (or more spare time), I'd get rid of shell wrapper at all and implement waiting loop in bootstrap.js itself, especially considering its simplicity.
Regarding signals handling - can it somehow affect functions execution in knative service environment? If we need to fix this, I'd take a bit more time to rewrite bootstrap.js and get rid of shell wrapper
It works now. Shutdown might take longer without signals, and any user-written cleanup code might not happen.
I agree with your ambition to avoid the shell wrappers.