My rails application doesn't response for the address I configured in nginx (No data response. Error 324 (net::ERR_EMPTY_RESPONSE)). Now I'm trying to figure out what the problem could be. Nginx log has per request:
libc++abi.dylib: terminate called throwing an exception
2013/10/21 15:15:30 [alert] 54636#0: worker process 54723 exited on signal 6
If I look into application log - there is no changes, looks, like passenger didn't request something from the app. So I though about another log files, where I could gather some information.
Where does passenger locate its log file?
Is there any special?
Or does passenger use one of the application logs?
In Linux, you can find your log files under
/var/log/nginx/access.log
/var/log/nginx/error.log
Old question, just for the records:
By default Passenger log messages are written to the Nginx global error log.
This exert comes from a recent version. It may not apply before Passenger 5.0.5.
i got passenger error log from /tmp folder(error log in .html format), and i used scp command to copy to my local machine from server
Passenger prints its own logs not only to the terminal, but also to a log file. During startup, Passenger tells you what log file it used. This is typically log/passenger.XXXX.log.
see
https://www.phusionpassenger.com/docs/tutorials/quickstart/ruby/
mine was[3000 was port number for the app] less {app_dir}/log/passenger.3000.log
if the passenger crashes, it shows on the console & passenger.xxxx.log the directory where the log files are
[ pid=2659 ] Crash log files will be dumped to /var/tmp/passenger-crash-log.1583439070.ZfMXhF <--- ******* LOOK HERE FOR DETAILS!!! *******
Related
I tried to deploy my rails app on nginx and ubuntu via capistrano like the tutorial on the page https://gorails.com/deploy/ubuntu/14.04.
but at the end i get an error message:
Incomplete response received from application
in my browser.
this is probably an error from passenger, but how can i figure out what to do?
Your rails_env production don't have required set up,probably missing secret_key_base.
Open /etc/nginx/sites-available/default and change the rails_env to development:
rails_env production;
to
rails_env development;
If the app is loading it's not a passenger issue.
Production Solution:
Enter your app root
run: rake secret
copy the output
go to /yourapp/config/secrets.yml
set the production secret_key_base
Restart the passenger app :
touch /yourapp/tmp/restart.txt
This error occurs because you didn't set the secret_key_base. Follow these steps to fix it:
Go to your rails app directory
cd /path/rails-app
Generate secret key base
rake secret RAILS_ENV=production
Set environment variable
SECRET_KEY_BASE=<the-secret-key-base>
Restart the Rails app
touch /path/rails-app/tmp/restart.txt
I had this problem over the weekend (it turned out there was an incompatibility between my versions of passenger and ruby).
However, nobody seems to be mentioning: the actual error might appear in /var/log/apache2/errors.log, not in any custom log.
Once you know that, hopefully your search will be easier!
Update, since I needed to refer back to this again - this hold true for nginx too - /var/log/nginx/error.log is your friend in that case!
For those using Passenger:
• Navigate to root of your project.
• run bundle exec rake secret RAILS_ENV=production
• Copy the output and then run sudo nano config/secrets.yml
• Under production, replace the value of the secret_key_base with the recently copied rake secret.
• press CNTRL+X, then press y, then hit enter.
• run passenger-config restart-app and select the app you wish to restart.
https://www.phusionpassenger.com/library/admin/apache/restart_app.html
In my case, it was because my server was running out of RAM intermittently (during PDF generation). Once the PDF was generated, some RAM was restored and the error would disappear.
I had an ubuntu server with 500M of RAM.
I added some swap space and this error disappeared.
Might be my answer is off topic, but when my database mysql server isn't running, i got this error too. Just in case someone has the same error.
so start/restart your database might be another answer.
This means that your rails app tanked before actually getting to rails itself. This could be an exception in middleware, missing ENV key, something at the OS level.
Try booting the app locally first and doing what you did to get the error in production. If everything is fine, check all of your logs. Check nginx logs, your passenger logs, and finally any other OS specific logs pertaining to booting and running your app.
Is there anybody like me who got this error after uploading a file?
My solution is check the name of the file which may has some special characters like `[(~.
Just remove it then upload the file again.
Good luck~
I got this, only on my test server and not in production, because I was requesting a URL that didn't exist, and I guess in the test environment, Rails throws an error instead of returning a 404 response.
I installed a Rails app on the DigitalOcean server, but instead of seeing the app itself, there's the error 500 page.
When I check the directory "logs", there are no data written in the production.log file, or in the unicorn.log.
So, how can I find out what's wrong?
You could try look for nginx's logs in:
/var/log/nginx
usually are placed there:
access.log and error.log
I'm using Apache 2.4 along with Phusion Passenger 4.0.5 and for some reason I am seeing errors come up from time to time for Rails apps without any real seeming rhyme or reason. When I look into the Apache error logs, I only see the following very vague error:
[ 2013-07-01 10:56:01.0046 26104/7ff716d317c0 apache2/Hooks.cpp:757 ]: Unexpected error in mod_passenger: Cannot connect to the helper agent
Backtrace:
(empty)
Any way to force more verbosity from Apache and Passenger to facilitate troubleshooting here?
This error message is printed when the HelperAgent has crashed. The code in Apache will wait until the Watchdog restarts the HelperAgent, after which the connection is reestablished. If anything goes wrong, this is the message you get. What you should look for are the earlier messages. Are there any messages from earlier that may tell you why the HelperAgent crashed in the first place, or why it failed to restart? If you look at passenger-memory-stats, do you see the PassengerHelperAgent and PassengerWatchdog?
This is a bug in Passenger 4.0.7, Update to 4.0.8 or the lasted version of passenger and run again :
passenger-install-apache2-module
then update your apache config file.
source
I have my app in production mode in my linode account and I get in one page a 500 internal server error the message:
We're sorry, but something went wrong.
However in my development environment works fine this page.
How can I debug this error?
How can I see the error origin in my production mode?
I want that rails show errors in production mode.
How can I do it?
Thank you!
If you have access to ssh, log in to your server via ssh and go to your rails log directory, which is inside your rails directory.
Once you are there run the command tail production.log . If this doesn't give you enough information you can also do a tail -n100 production.log (gives you last hundred lines of the production log).
If you have deployed via heroku, then you can access the logs by running heroku logs in your local console. (more information here https://devcenter.heroku.com/articles/logging)
I also find it helpful to use the exception_notification gem https://github.com/rails/exception_notification when running in production, as it emails you a stacktrace when an error occurs. Plenty of others also use Hoptoad (http://hoptoadapp.com/) or Exceptional (http://www.exceptional.io/) however i prefer the simple exception_notification gem.
Also, in some rare occasions when i can't trace the error as a final measure i sometimes open up port 3000 temporarily on the remote server firewall and cd to the rails project and run rails server production with the log level set to debug in config/environments/production.rb so i can see the error in the console, and then close off the port when i have finished.
Hope that helps.
tail -n100 production.log
will only show the last 100 lines of the log file. Just in case you want to see the log running in real time.
use this
tail -1000f log/production.log
I have cleared my Rails app's log file with rake log:clear.
Then Rails stopped logging the errors.... the Logfile is still empty, even though errors appeared again.
Any help?
Greets,
Joern.
It might be possible that you changed the permissions on the log file by mistake, and the user you're running your webapp server with is not the same as the one that owns the logfile.
In any case, if you run 'script/console', it should warn you if it can't write to the log file. If it doesn't, then a logfile has gotta be being written somewhere.
This is the warning the console will print if it can't write to the logfile for some reason:
Rails Error: Unable to access log
file. Please ensure that
/Users/mtoledo/Projects/stackoverflow/log/development.log
exists and is chmod 0666. The log
level has been raised to WARN and the
output directed to STDERR until the
problem is fixed. Loading development
environment (Rails 3.0.0.beta4)
Also, keep in mind it will be writing to 'development.log' unless you're changing your environment, but since you said it was writing to it before I assume that's not the issue
In the end, what's, to me, the final procedure is:
chown the log files to your web user
chmod 0666 to the log files
Restart your rails setup which can be:
Passenger -> Restart nginx/apache/proxy ( service nginx/apache2 restart would suffice )
WEBRick/Rack -> Restart these one
Unicorn -> kill -9 unicorn and launch again ( -HUP or -USR2 don't seem to reload filesystem changes properly )