-
Notifications
You must be signed in to change notification settings - Fork 550
Error during shutdown on Heroku with 5.1.7 #1970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It looks like the tmp dir is being cleaned up before the nginx process exits. And nginx complains if it's config is missing when it shuts down. This may be a race condition between the tempdirtoucher and the webapp/nginx shutting down. |
Just some more info: this didn't happen in 5.1.4, so it must be some kind of regression. I don't know about the versions between (5.1.5, 5.1.6). Also, this happens deterministically on every dyno shutdown. |
Does this still occur if you delete the lines added in this commit? 80b64fd9 |
I'm not quite sure how I can delete these lines? Fork the repo? Or is there an easier way? |
You can just edit the file at |
I don't believe this possible on Heroku, or can you point me in the right direction? |
I believe you would have to This isn't meant to be a "fix" just a diagnostic step. |
@CamJN I'm experiencing this issue as well, also on Heroku, and willing to help debug. But I'm kinda stumped. |
Yes you'd have to go through the setup process which for heroku would mean gem installing passenger first, assuming that the |
@CamJN I tried starting Passenger in a one-off dyno, without modifying any files, but it didn't produce the stop error. I think this is because one-off dynos are not configured with nginx to be web facing like Heroku's web dynos are. |
You can send requests to Passenger using curl. |
To clarify....I can't reproduce the error in a one-off dyno. When I run Passenger and then stop it, I don't get the stop error. However, when I stop a normal web dyno that is running passenger, I do get the stop error. So I can reproduce only in a web dyno - but I can't edit files on the filesystem of a running dyno due to Heroku's limitations (you can't SSH into it). Is there anything else to try? |
@xtagon this is a beta feature, but you can ssh into running instances since March, see https://devcenter.heroku.com/articles/heroku-exec . I haven't had the time yet to try it. |
I used [1]: Heroku dynos don't have vim or vi |
I will also note that I'm seeing this problem on one of my apps that is still using 5.1.6 (so now we know it was a problem before 5.1.7) |
Would it be possible to try and find the first version of Passenger that introduced this issue? |
In case it helps: I have tried to configure via ENV Connecting through "heroku ps:exec" the file is indeed at Then, restarting the web dyno I can get 2 different results (without changing anything, just consecutive restarts):
|
Ok so I recreated your environment as described and still can't replicate this, however I created a |
Here's how I was working with the branch on heroku without too much trouble: |
I have updated Gemfile and Procfile as suggested. Here is the log when starting the dyno:
I understand that it has something to do with
What would I need to add to build them on deploy? Is that something that would also be recommended for a production app? I initially followed the steps on |
What I did was just mount my passenger source dir into docker running the This isn't IMO a good production setup, but it's fine for debugging purposes. |
Thank you for the tips. I managed to compile the binaries using docker image Test 1Gemfile
Test 2Gemfile As far as I can tell, I would be using standard passenger 5.2.0 but with manually-compiled binaries, right?. In this case, the log is similar and always restarts with: Test 3Gemfile Going back to standard passenger 5.2.0 and downloaded-at-boot binaries. Restarting the web dyno I get 2 different results (randomly):
Test 4Gemfile Standard passenger 5.2.1 and downloaded-at-boot binaries. Same results as in 5.2.0:
Hope this helps! |
Test 1 is the only one where the supplemental startup logs are provided and it does not display the problem, so unfortunately this does not help clarify the issue. |
I'm sorry, I thought the main issue was the error during shutdown, specifically as @mwmeyer also reported If there is any new information that can be provided please let me know. Thank you! |
The problem is that the pid file doesn't seem to be where it is supposed to be, therefore when passenger shuts down it throws this error. So i'm trying to figure out why the pid file is being saved to the wrong location, that's what the extra logging is attempting to reveal. I force-pushed to the heroku_testing branch which is now rebased off the most recent release. So there should be no need to do the whole dance with the binaries. Just |
Thank you for your prompt reply! On the tests I have done with ENV var
In all other cases where the log is |
Is this still an issue? |
Yes, I include below the logs for passenger v6.0.2:
Thank you for reviewing this issue! |
This is a race condition. Heroku terminates both Nginx and the Passenger Standalone CLI process simultaneously. When Passenger Standalone stops, it tries to stop Nginx. If by that point Nginx is already stopped, then the PID file is already gone, so stopping Nginx again (by invoking You can reproduce this by sending SIGTERM to Nginx and the Passenger Standalone CLI process simultaneously. There have been two attempts in the past to fix this:
The latter fix was actually redundant because it essentially does the same thing as the former. And neither fix helped in the end, because what we have here is a race condition. If Nginx deletes its PID file after DaemonController determines that Nginx is still running (and thus needs to run the stop command) then that results in the error @alexpedrosag is seeing. We need to fix this in a race condition free manner. Here are possible strategies:
|
Issue report
Question 1: What is the problem?
After upgrade to 5.1.7 (from 5.1.4) the following error happens during shutdown. It's not a huge problem as the dyno is killed afterwards anyway, but didn't happen before the update.
Question 2: Passenger version and integration mode:
open source 5.1.7 standalone (on Heroku)
Question 3: OS or Linux distro, platform (including version):
Heroku, cedar-14 stack
Question 4: Passenger installation method:
RubyGems + Gemfile
Question 5: Your app's programming language (including any version managers) and framework (including versions):
Ruby 2.2.7, Rails 4.2.9
Question 6: Are you using a PaaS and/or containerization? If so which one?
Heroku
Question 7: Anything else about your setup that we should know?
/
The text was updated successfully, but these errors were encountered: