Skip to content
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

Random error on service reset #194

Open
mikemimik opened this issue Feb 11, 2016 · 3 comments
Open

Random error on service reset #194

mikemimik opened this issue Feb 11, 2016 · 3 comments

Comments

@mikemimik
Copy link

TypeError: /home/eric/soundtrack.io/views/index.jade:33
   31|             .btn-group
   32|               a.btn.btn-mini(href="#", data-action="skip-track") skip
 > 33|               if (user && room._owner && (user._id.toString() === room._owner._id.toString()) || (user && user.roles && ~user.roles.indexOf('admin')))
   34|                 a.btn.btn-mini(data-action="ban-track", data-for="current-track-id") ban
   35| 
   36|               if (user && user.roles.indexOf('editor') >= 0)

Cannot call method 'toString' of undefined
   at eval (eval at <anonymous> (/home/eric/soundtrack.io/node_modules/jade/lib/jade.js:164:8), <anonymous>:780:71)
   at /home/eric/soundtrack.io/node_modules/jade/lib/jade.js:165:35
   at Object.exports.render (/home/eric/soundtrack.io/node_modules/jade/lib/jade.js:199:14)
   at View.exports.renderFile [as engine] (/home/eric/soundtrack.io/node_modules/jade/lib/jade.js:226:13)
   at View.render (/home/eric/soundtrack.io/node_modules/express/lib/view.js:93:8)
   at EventEmitter.app.render (/home/eric/soundtrack.io/node_modules/express/lib/application.js:566:10)
   at ServerResponse.res.render (/home/eric/soundtrack.io/node_modules/express/lib/response.js:938:7)
   at /home/eric/soundtrack.io/controllers/pages.js:48:11
   at /home/eric/soundtrack.io/node_modules/async/lib/async.js:232:13
   at /home/eric/soundtrack.io/node_modules/async/lib/async.js:119:25
@diginc
Copy link

diginc commented Feb 19, 2016

I see this a after upgrading to a newer git hash and restarting my service. It seems like a temporary error that a logout / login or return to core room listing / re-entering room fixes.

My only guess is it hasn't connected to mongo yet so user._id is still undefined.

My only guess is it hasn't connected to mongo yet so user._id is still undefined.

@martindale
Copy link
Member

This problem persists even after connecting to mongo, all the way up to viewing the very front page of your instance. I suspect there's some reference getting updated on the viewing of that page (related to the population of the room._owner object). Maybe we can use git bisect between current and whatever your previous commit was, @diginc?

@diginc
Copy link

diginc commented Feb 23, 2016

I had this my past 2 upgrades...the 2nd to latest upgrade I freaked out and reverted to older and older hashes until the error went away. Then I rolled forward 1 hash at a time and couldn't reproduce so went back to latest.

The reason I became convinced it was a service restart/startup issue was the past upgrade I did was from before the #185 Merge to #187 revert of that merge...so no code actually changed, I just ran a service soundtrack restart to restart node.

I dropped this reminder to my self of the hashes and the error on my server:

root@magus /home/soundtrack/soundtrack.io (soundtrack.io) $ cat upgrades.txt 
2016/02/05 old hash: 587366fdb70958f8a72c0f5c3ba9983104c89786
2016/02/05 new hash: 1ee3fbb31e57d1bd09af82dae0945879ddd1bf14

TypeError: /home/soundtrack/soundtrack.io/views/index.jade:33
   31|             .btn-group
   32|               a.btn.btn-mini(href="#", data-action="skip-track") skip
 > 33|               if (user && room._owner && (user._id.toString() === room._owner._id.toString()) || (user && user.roles && ~user.roles.indexOf('admin')))
   34|                 a.btn.btn-mini(data-action="ban-track", data-for="current-track-id") ban
   35| 
   36|               if (user && user.roles.indexOf('editor') >= 0)

Cannot call method 'toString' of undefined
   at eval (eval at <anonymous> (/home/soundtrack/soundtrack.io/node_modules/jade/lib/jade.js:164:8), <anonymous>:780:71)
   at /home/soundtrack/soundtrack.io/node_modules/jade/lib/jade.js:165:35
   at Object.exports.render (/home/soundtrack/soundtrack.io/node_modules/jade/lib/jade.js:199:14)
   at View.exports.renderFile [as engine] (/home/soundtrack/soundtrack.io/node_modules/jade/lib/jade.js:226:13)
   at View.render (/home/soundtrack/soundtrack.io/node_modules/express/lib/view.js:126:8)
   at tryRender (/home/soundtrack/soundtrack.io/node_modules/express/lib/application.js:639:10)
   at EventEmitter.render (/home/soundtrack/soundtrack.io/node_modules/express/lib/application.js:591:3)
   at ServerResponse.render (/home/soundtrack/soundtrack.io/node_modules/express/lib/response.js:961:7)
   at /home/soundtrack/soundtrack.io/controllers/pages.js:43:11
   at /home/soundtrack/soundtrack.io/node_modules/async/lib/async.js:232:13

I'll upload my /etc/init.d service and start.sh script if you think it has something to do with the way I restart.

Edit: shell scripts here: https://gist.github.com/diginc/f54a5d7c6e7e66e28a40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants