Error starting Express app on Nginx + passenger

93 views
Skip to first unread message

Maximiliano Maldonado

unread,
Dec 19, 2016, 9:58:19 AM12/19/16
to phusion-...@googlegroups.com
Hi, 

Im trying to start an express application on a server with:

Ubuntu 16.04
Phusion Passenger 5.0.30
nginx version: nginx/1.10.1
node v4.2.6
npm 3.5.2


, but it fails.

The conf file is:

server {
    listen 3001;
    server_name 207.244.71.80;

    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/html/webApp/public;

    # Turn on Passenger
    passenger_enabled on;
    # Tell Passenger that your app is a Node.js app
    passenger_app_type node;
    passenger_startup_file /var/www/html/webApp/app.js;
}


package.json

package.json 
{
  "name": "boldweb",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start_dev": "node ./bin/www dev",
    "start_prod": "node ./bin/www prod",
    "start_prod_destroy": "node ./bin/www prod destroySrc",
    "start": "node ./bin/www prod destroySrc"
  },
  "dependencies": {
    "body-parser": "~1.15.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.2.0",
    "ejs": "^2.5.2",
    "express": "~4.14.0",
    "gulp": "^3.9.1",
    "gulp-bytediff": "^1.0.0",
    "gulp-concat": "^2.6.1",
    "gulp-ng-annotate": "^2.0.0",
    "gulp-plumber": "^1.1.0",
    "gulp-uglify": "^2.0.0",
    "jade": "~1.11.0",
    "morgan": "~1.7.0",
    "node-sass-middleware": "^0.10.0",
    "serve-favicon": "~2.3.0"
  },
  "devDependencies": {
    "del": "^2.2.2",
    "gulp": "^3.9.1",
    "gulp-js-obfuscator": "^1.0.0"
  }
}



The log in /var/log/nginx when I access to the url is:

[ 2016-12-19 09:33:11.3590 692/7fd5f9a98700 age/Cor/App/Implementation.cpp:304 ]: Could not spawn process for application /var/www/html/webApp: An error occurred while starting the web application: it did not write a startup response in time.
  Error ID: 3724c2ce
  Error details saved to: /tmp/passenger-error-hvKbiv.html
  Message from application: An error occurred while starting the web application: it did not write a startup response in time. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>
<h2>Raw process output:</h2>
(empty)

[ 2016-12-19 09:33:11.3770 692/7fd634e76700 age/Cor/Con/CheckoutSession.cpp:285 ]: [Client 6-10] Cannot checkout session because a spawning error occurred. The identifier of the error is 3724c2ce. Please see earlier logs for details about the error.


If a run the app manually with npm start, it runs OK.

Any suggestions ? 

Thanks, Maxi.


Daniel Knoppel

unread,
Dec 19, 2016, 12:00:00 PM12/19/16
to Phusion Passenger Discussions
> An error occurred while starting the web application: it did not write a startup response in time.

Maximiliano Maldonado

unread,
Dec 19, 2016, 12:17:28 PM12/19/16
to phusion-...@googlegroups.com
I changed from default to 300, but the problem is still the same.

Thk.

--
You received this message because you are subscribed to a topic in the Google Groups "Phusion Passenger Discussions" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/phusion-passenger/yi1yQfUQG9A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to phusion-passenger+unsubscribe@googlegroups.com.
To post to this group, send email to phusion-passenger@googlegroups.com.
Visit this group at https://groups.google.com/group/phusion-passenger.
To view this discussion on the web visit https://groups.google.com/d/msgid/phusion-passenger/8b3fee04-d757-4b01-b4a5-ca8ede39d009%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Daniel Knoppel

unread,
Dec 20, 2016, 6:43:20 AM12/20/16
to Phusion Passenger Discussions
And did you check your app doesn't have any of the problems mentioned in the URL that is shown in the error message?



On Monday, December 19, 2016 at 5:17:28 PM UTC, Maximiliano Maldonado wrote:
I changed from default to 300, but the problem is still the same.

Thk.

Maximiliano Maldonado

unread,
Dec 20, 2016, 9:26:38 AM12/20/16
to phusion-...@googlegroups.com
Yes, I checked that the app doesn't have any of these problems.

:(


Maximiliano Maldonado

unread,
Dec 20, 2016, 9:33:56 AM12/20/16
to Phusion Passenger Discussions
More info of the problem....
 
sudo cat /tmp/passenger-error-kinght.html


 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="generator" content="Phusion Passenger">
<title>Web application could not be started</title>
<style type="text/css">
body {
font-family: Verdana, 'Bitstream Vera Sans', Arial, Sans-Serif;
font-size: 10pt;
background: white;
color: #222222;
margin: 0;
padding-top: 3em;
padding-bottom: 3em;
padding-left: 4.5em;
padding-right: 4.5em;
}

h1 {
font-size: 17pt;
font-weight: medium;
color: #533e72;
border-bottom: 1px solid #533e72;
}

h1.title {
margin-top: 0;
}

h1.error_title {
color: red;
border-bottom: 1px solid red;
}

a {
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

dt {
font-weight: bold;
color: #280050;
}

dd {
margin-top: 0.5em;
margin-bottom: 1em;
}

.commands {
border: 1px solid #b594e7;
background: #ddc6ff;
padding: 0.5em;
margin: 0.5em;
font-family: 'Bitstream Vera Sans Mono', 'Courier New', Monospace;
}

pre {
overflow: auto;
white-space: pre-wrap;
text-align: left;
}

table.backtrace th {
background: #8470a6;
color: white;
}

table.backtrace th,
table.backtrace td {
padding: 0.2em;
padding-left: 0.4em;
padding-right: 0.4em;
}

table.backtrace tr td {
background: #ecdfff;
}

table.backtrace tr.even td {
background: #f7f2ff;
}

table.backtrace td.index {
font-weight: bold;
}

#site_footer {
border-top: solid 1px black;
margin-top: 1em;
padding-top: 1em;
font-size: small;
color: #777777;
}

#site_footer a {
color: #65498e;
}

#site_footer a:hover {
color: #9681d9;
}

#site_header .corporate_identity {
display: none;
}

</style>
<link rel="stylesheet" type="text/css" href="http://www.modrails.com/error_pages/1.0/error_page.css">
<style type="text/css">
dd {
text-align: left;
}

dd pre {
margin-top: 0;
margin-bottom: 0;
}
</style>
</head>

<body>

<div id="site_container">
<div id="site_header">
<ul class="corporate_identity">
<li class="logo"><a href="https://www.phusionpassenger.com"><span>Phusion Passenger</span></a></li>
</ul>
</div>
<div id="site_body">
<h1 class="error_title">Web application could not be started</h1>
<div id="content">
An error occurred while starting the web application: it did not write a startup response in time. Please read <a href="https://github.com/phusion/passenger/wiki/Debugging-application-startup-problems">this article</a> for more information about this problem.<br>
<h2>Raw process output:</h2>
(empty)

<dl>
<dt>Error ID</dt>
<dd>e60577e0</dd>
<dt>Application root</dt>
<dd>/var/www/html/webApp</dd>
<dt>Environment (value of RAILS_ENV, RACK_ENV, WSGI_ENV, NODE_ENV and PASSENGER_APP_ENV)</dt>
<dd>production</dd>
<dt>User and groups</dt>
<dd><pre>uid=<wbr>1000(bold) gid=<wbr>1000(bold) groups=<wbr>1000(bold),<wbr>4(adm),<wbr>24(cdrom),<wbr>27(sudo),<wbr>30(dip),<wbr>46(plugdev),<wbr>110(lxd),<wbr>115(lpadmin),<wbr>116(sambashare)
</pre></dd>
<dt>Environment variables</dt>
<dd><pre>SHELL=<wbr>/bin/bash
PASSENGER_DEBUG_DIR=<wbr>/tmp/passenger.spawn-debug.XXXX25Cm2i
USER=<wbr>bold
PASSENGER_USE_FEEDBACK_FD=<wbr>true
PWD=<wbr>/var/www/html/webApp
SHLVL=<wbr>0
HOME=<wbr>/home/bold
LOGNAME=<wbr>bold
SERVER_SOFTWARE=<wbr>nginx/1.10.1 Phusion_Passenger/5.0.30
IN_PASSENGER=<wbr>1
PYTHONUNBUFFERED=<wbr>1
NODE_PATH=<wbr>/var/lib/gems/2.2.0/gems/passenger-5.0.30/src/nodejs_supportlib
RAILS_ENV=<wbr>production
RACK_ENV=<wbr>production
WSGI_ENV=<wbr>production
NODE_ENV=<wbr>production
PASSENGER_APP_ENV=<wbr>production
</pre></dd>
<dt>Ulimits</dt>
<dd><pre>Unknown</pre></dd>
<dt>System metrics</dt>
<dd><pre>------------- General -------------
Kernel version    :<wbr> 4.4.0-31-generic
Uptime            :<wbr> 59d 14h 4m 10s
Load averages     :<wbr> 0.12%,<wbr> 0.03%,<wbr> 0.01%
Fork rate         :<wbr> unknown

------------- CPU -------------
Number of CPUs    :<wbr>    8
Average CPU usage :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 1           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 2           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 3           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 4           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 5           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 6           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 7           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
  CPU 8           :<wbr>   0%  --   0% user,<wbr>   0% nice,<wbr>   0% system,<wbr> 100% idle
I/O pressure      :<wbr>   0%
  CPU 1           :<wbr>   0%
  CPU 2           :<wbr>   0%
  CPU 3           :<wbr>   0%
  CPU 4           :<wbr>   0%
  CPU 5           :<wbr>   0%
  CPU 6           :<wbr>   0%
  CPU 7           :<wbr>   0%
  CPU 8           :<wbr>   0%
Interference from other VMs:<wbr>   0%
  CPU 1                    :<wbr>   0%
  CPU 2                    :<wbr>   0%
  CPU 3                    :<wbr>   0%
  CPU 4                    :<wbr>   0%
  CPU 5                    :<wbr>   0%
  CPU 6                    :<wbr>   0%
  CPU 7                    :<wbr>   0%
  CPU 8                    :<wbr>   0%

------------- Memory -------------
RAM total         :<wbr>   7983 MB
RAM used          :<wbr>   1293 MB (16%)
RAM free          :<wbr>   6689 MB
Swap total        :<wbr>   8191 MB
Swap used         :<wbr>     13 MB (0%)
Swap free         :<wbr>   8178 MB
Swap in           :<wbr> unknown
Swap out          :<wbr> unknown

</pre></dd>
</dl>
</div>
</div>
<div id="site_footer">
<!--
  You are free to modify the footer as you see fit,
  but we kindly ask of you to preserve to following
  text. Thank you.
-->
<div class="container">
Powered by <a href="https://www.phusionpassenger.com/">Phusion Passenger</a>,
<tt>mod_rails</tt> / <tt>mod_rack</tt> for Apache and Nginx.
</div>
</div>
</div>

</body>
</html>

Daniel Knoppel

unread,
Dec 21, 2016, 6:46:02 AM12/21/16
to Phusion Passenger Discussions
Passenger can't do much if the application doesn't respond, so I'm not sure how to help other than to ask you to verify what your app does during startup (for example, are you sure it's not trying to contact some 3rd party API that might block).

And what was the outcome of the test you needed to do to check for the stdout problem?

- Daniel


On Tuesday, December 20, 2016 at 2:26:38 PM UTC, Maximiliano Maldonado wrote:
Yes, I checked that the app doesn't have any of these problems.

:(

Maximiliano Maldonado

unread,
Dec 21, 2016, 9:19:53 AM12/21/16
to phusion-...@googlegroups.com
The problem was related to the start_up file, it wasn't the correct one. 

I fixed it...

Thanks Daniel. 

Reply all
Reply to author
Forward
0 new messages