My app generates some image data on the fly and sends it back to the browser with send_data some_huge_blob, :type => 'image/png'. This works well enough in development mode, but in production with nginx/passenger in the mix it appears as if sometimes passenger just crashes. Here is the debug output in my nginx log
[ pid=596 thr=140172782794496 file=ext/common/ApplicationPool/Pool.h:1162 time=2011-07-25 23:15:14.965 ]: Exception occurred while connecting to checked out process 1428: Cannot connect to Unix socket '/tmp/passenger.1.0.589/generation-0/backends/ruby.kJRjXYuZteKoogZIufN8a2cDPdpbIlYmIr1hh3G9UV7GhKDB4pqZ5y0jR': Connection refused (111)
[ pid=596 thr=140172782794496 file=ext/common/ApplicationPool/Pool.h:685 time=2011-07-25 23:15:14.965 ]: Detaching process 1428
[ pid=596 thr=140172782794496 file=ext/common/ApplicationPool/../Process.h:138 time=2011-07-25 23:15:14.969 ]: Application process 1428 (0x2676ee0): destroyed.
[ pid=1405 thr=70178806733240 file=abstract_request_handler.rb:466 time=2011-07-25 23:15:14.982 ]: Accepting new request on main socket
2011/07/25 23:15:16 [error] 642#0: *96 upstream prematurely closed connection while reading response header from upstream, client: 173.8.216.57, server: app.somedomain.com, request: "GET /projects/4e2dee4c106a821bf2000008/revisions/1/assets/Layout2.psd/preview HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "app.somedomain.com"
Note that there is nothing in my production.log file that indicates the request even makes it to the app!
Any ideas? Or ideas as to how to debug this further? The connection refused bit is interesting...
For what it's worth, this is an Ubuntu image on a micro instance in AWS.
Related
I'm developing an application where a user can upload 1-3 images at some point. However, this does not work. When submitting the form, nothing will come through to Unicorn. The only piece of log information I have is this from nginx:
2014/09/24 15:28:05 [error] 7301#0: *23953 readv() failed (104: Connection reset by peer) while reading upstream, client: <my IP>, server: localhost, request: "POST /products HTTP/1.1", upstream: "http://unix:/tmp/<appname>/unicorn.sock:/products", host: "<domain>", referrer: "<domain>/products/new"
Also, my browser will try to load the page for some time, and then show a blank page, with the response header giving a 500.
EDIT: okay, as it seems, rack causes a crash when processing file uploads:
E, [2014-09-24T21:22:33.505511 #18252] ERROR -- : app error: invalid byte sequence in UTF-8 (ArgumentError)
E, [2014-09-24T21:22:33.506288 #18252] ERROR -- : kernel/common/string.rb:103:in `=~'
E, [2014-09-24T21:22:33.506392 #18252] ERROR -- : /srv/<appname>/.rvm/gems/rbx-2.2.10/gems/rack-1.5.2/lib/rack/multipart/parser.rb:92:in 'get_current_head_and_filename_and_content_type_and_name_and_body'
Check your unicorn configuration in unicorn.rb and try to modify the timeout
I have the following error in my nginx logs:
2014/09/23 01:56:40 [info] 18250#0: *38 epoll_wait() reported that
client prematurely closed connection, so upstream connection is closed
too while sending request to upstream, client: 49.128.46.126, server:
tm-google-dev.gumi.sg, request: "GET /versions/ping HTTP/1.1",
upstream: "passenger:/tmp/passenger.1.0.18229/generation-0/request:",
host: "tm-google-dev.gumi.sg:443"
It is not exactly an error 500 or 403, so i can't make out what is it trying to say. Please help. Thanks. The app is a rails app.
I am trying to configure nginx for a rails app on DigitalOcean. When I open my IP, I see the BAD GATEWAY (502) message.
In logs is
2014/06/03 09:58:57 [crit] 28612#0: *1 connect() to unix:/tmp/unicorn.myproject-staging.sock failed (2: No such file or directory) while connecting to upstream, client: 81.161.64.26, server: , request: "GET / HTTP/1.1", upstream: "http://unix:/tmp/unicorn.myproject-staging.sock:/500.html", host: "my_ip"
What does error message means and how could I fix it?
Thank you
EDIT:
The application is deployed here:
/home/deployer/apps/myproject-staging
Please check to ensure your Unicorn is running and the path to the unix socket file is right.
It's really tricky in our production environment( Red Hat Enterprise Linux Server release 5.4 (Tikanga) and curl 7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5) that the POST request become to GET request automatically. Below is the relative log provide by nginx.
cache: [GET /login] miss
url->http://localhost:8080/login
About to connect() to localhost port 8080
Expire at 1339680839 / 265363 (300000ms)
Trying 127.0.0.1... * connected
Connected to localhost (127.0.0.1) port 8080 /usr/local/lib/ruby/gems/1.8/gems/typhoeus-0.4.0/lib/typhoeus/multi.rb:141: [BUG] Segmentation fault ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
2012/06/14 21:28:59 [error] 29829#0: *6031 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "POST /login HTTP/1.1", upstream: "passenger:unix:/passenger_helper_server:", host: "127.0.0.1:8081", referrer: "http://127.0.0.1:8081/login"
In fact, we send a POST request to login, but it convert to GET actually.
In our development environment( which is Ubuntu12.04 and curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3), everything goes ok.
Who can explain it?
After I upgraded the curl from 7.15 to 7.22. The problem has been solved.
I'm using Apache + passenger for my rails application, The application is running fine in production mode except when the browser displays error message after every 2-3 clicks in development mode which goes off when i refresh the page.I'm using metal in my rails application which i see could be the reason but not sure if it is the only reason.
Error message on browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Apache/2.2.16 (Ubuntu) Server at localhost Port 80
Apache log Error:
[Thu Dec 01 16:55:23 2011] [error] [client 127.0.0.1] Premature end of script headers: view_transactions, referer: http://localhost/admin_portal/1014978061/view_transactions
[ pid=660 thr=3078097552 file=ext/apache2/Hooks.cpp:822 time=2011-12-01 16:55:23.563 ]: The backend application (process 796) did not send a valid HTTP response; instead, it sent nothing at all. It is possible that it has crashed; please check whether there are crashing bugs in this application.
[ pid=796 thr=-608495398 file=utils.rb:176 time=2011-12-01 11:25:23.878 ]: *** Exception NoMethodError in application (undefined method `new' for Rails:Module) (process 796, thread #<Thread:0xb77631b4>):
from /home/brijendra/aptana_studio_3_workspace/wantsa/vendor/plugins/newrelic_rpm/lib/new_relic/control.rb:467:in `new_instance'
from /home/brijendra/aptana_studio_3_workspace/wantsa/vendor/plugins/newrelic_rpm/lib/new_relic/control.rb:54:in `instance'
from /home/brijendra/aptana_studio_3_workspace/wantsa/vendor/plugins/newrelic_rpm/lib/new_relic/agent.rb:167:in `logger'
I would be eager to post any other output if required and also suggestions to fix this issue.
I fixed this error by changing cache as true in my development.rb and it worked fine.