Error when restarting on Heroku #33

Closed
jcteague opened this Issue Apr 20, 2012 · 3 comments

Comments

Projects
None yet
3 participants

I'm having an issue occasionally when heroku restarts my application. It's starts with this error:

132 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - TypeError: Cannot call method 'update' of null
173 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at MongoStore.set (/app/node_modules/connect-mongodb/lib/connect-mongodb.js:145:15)
194 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at Session.save (/app/node_modules/express/node_modules/connect/lib/middleware/session/session.js:83:25)
201 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse. (/app/node_modules/express/node_modules/connect/lib/middleware/session.js:280:21)
162 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse.send (/app/node_modules/express/lib/response.js:108:8)
162 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse._render (/app/node_modules/express/lib/view.js:442:10)
161 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse.render (/app/node_modules/express/lib/view.js:318:17)

And then after that the app goes into an infinite loop with this error message:

131 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - Error: Can't set headers after they are sent.
136 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse. (http.js:523:11)
185 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse.setHeader (/app/node_modules/express/node_modules/connect/lib/patch.js:62:20)
181 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at IncomingMessage.next (/app/node_modules/express/node_modules/connect/lib/http.js:165:13)
161 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at ServerResponse.render (/app/node_modules/express/lib/view.js:328:16)
110 <13>1 2012-04-20T04:06:36+00:00 d. app web.1 - - at /app/app.js:75:11

Until eventually I get memory exceeded errors and Heroku kills the app.

I'm using the MongoHQ add-on for the mongo store. Here is my app configuration:

mongo_url = process.env["MONGOHQ_URL"] || "mongodb://localhost/mydb";

app.configure(function(){
app.use(express.logger());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser('cookie'));
app.use(express.session({
key:'sid'
, secret: 'secret'
, cookie: { path: '/', maxAge: 60000000 * 5,secret:"1202nitsua" }
, store: new mongoSessionStore({
url: mongo_url
})
}));
app.use(express.static(path + '/public'));
});
app.configure('production',function(){
mongoose.connect(process.env["MONGOHQ_URL"]);
app.use(express.errorHandler());
});

Please let me know if I'm doing something wrong.
Thanks

I'm also seeing something like this with connect 1.8.7, express 2.5.9, and ConnectMongo 0.1.9. Node just goes into a ridiculous infinite loop.

What versions are you running? Did you find a solution?

Not yet. I've only seen it twice (not a busy site)

Node version is 0.6.14, Express is 2.5.8

I'm also going to post this to heroku support and see what they say

Owner

jdesboeufs commented Dec 17, 2014

Sorry but I'm cleaning old issues ;)

jdesboeufs closed this Dec 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment