You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removing an environment variable in .rbenv-vars file then restarting the app with passenger-config restart doesn't work, the variable with its old value persists in ENV.
The file attached below contains a test Sinatra app to reproduce the issue.
I'm not 100% sure that I agree that this is wrong behaviour in general, though it is certainly unexpected in this case.
When you start passenger with passenger start you are doing so in the dir with the rbenv-vars file, presumably using rbenv in your shell to run the correct ruby, so rbenv will load the initial env var into your shell env. Then when you start passenger it inherits the env vars from your shell, it then starts your app, using a child shell which loads rbenv and rbenv-vars which overrides the inherited env var from the parent shell. When you change the value of the env var in the file the changed value is what overrides the inherited env var so that still works as expected, however when you delete the env var from the rbenv-vars file, and restart the app, loading the env vars from rbenv-vars by the child shell doesn't clobber the inherited env var and thus you get the value from when the parent shell read the file and then started passenger.
This is certainly unexpected when you want the env to be managed by the rbenv-vars file but being able to inherit env vars from the parent process is also an expected capability for passenger. I'd recommend using the env utility to be sure passenger starts with only the env vars that are necessary to start the child shell which loads your app.
Removing an environment variable in
.rbenv-vars
file then restarting the app withpassenger-config restart
doesn't work, the variable with its old value persists inENV
.The file attached below contains a test Sinatra app to reproduce the issue.
test.zip
Reproduction Steps
passenger start --daemonize --load-shell-envvars
.curl http://localhost:3000
returnsfoo
, which is expected.FOO
value in.rbenv-vars
file.passenger-config restart-app
and test another request, it returns the new value, that's expected.FOO
inrbenv-vars
file.foo
, that's not expected.Passenger version: 6.0.19
OS: Ubuntu 22.04.2 LTS
The text was updated successfully, but these errors were encountered: