0

I was recently updating one of my coffee files in my Rails app (using NodeJS as my runtime) and after saving it, I reloaded the page and I got the ExecJS::RuntimeError page.

So I reverted back to what I had before and I was still getting the ExecJS::RuntimeError.

I then ran rake assets:clean and bundle exec rake tmp:clear thinking that it was just something that was cached and if I cleared it out everything would be ok. Still got the ExecJS::RuntimeError page. Rebooted Apache, and rebooted the server and still no go.

Next I looked to the logs and saw I kept getting this every time I loaded the page (ran abrt-cli list --since 1442790134):

   reason:         node killed by SIGSEGV
   time:           Sun 20 Sep 2015 08:05:56 PM EDT
   cmdline:        node /tmp/execjs20150920-17817-q0hw4js
   package:        nodejs-0.10.36-3.el7

Just to make sure it was Turbolinks causing this, I took out <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> from the top of my application layout template and all the pages in the app loaded just fine, just without javascript.

I'm running CentOS 7, Ruby 2.0.0p598, Rails 4.2.0, and NodeJS v0.10.36.

What could be causing this and what can I do to stop this from happening?

EDIT: That seems to have fixed the issue. By setting SELinux off for a bit (setenforce 0), it was able to write to wherever it needed and when I turned SELinux back on everything is back to normal. I'm still puzzled as to how this all started...

synthrom
  • 430
  • 6
  • 11

2 Answers2

0

the problem with temporary js file - it stops with SIGSEGV
so to find the problem run it manually:

node /tmp/execjs20150920-17817-q0hw4js  

You'll get the reason why it's stopping

num8er
  • 18,604
  • 3
  • 43
  • 57
  • I ran node /tmp/execjs20150920-17817-q0hw4js and got the following: module.js:340 throw err; ^ Error: Cannot find module '/tmp/execjs20150920-17817-q0hw4js' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Function.Module.runMain (module.js:497:10) at startup (node.js:119:16) at node.js:929:3 – synthrom Sep 21 '15 at 12:00
  • it means /tmp/execjs20150920-17817-q0hw4js does not exist (: – num8er Sep 21 '15 at 12:02
  • Well, yeah I got that, but how do I tell Rails to re-create it? – synthrom Sep 21 '15 at 12:02
  • Bundler must create it automatically, maybe permission problems? – num8er Sep 21 '15 at 12:07
  • The tmp folder has the following permissions: drwxrwxrwt. root root system_u:object_r:tmp_t:s0 tmp so I think it's alright – synthrom Sep 21 '15 at 12:11
  • So I ran `setenforce 0` and everything seemed to be working fine. Do you happen to know what permissions Bundler needs to where? – synthrom Sep 21 '15 at 12:21
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/90219/discussion-between-num8er-and-synthrom). – num8er Sep 21 '15 at 12:34
0

The issue is that I shouldn't put my Rails app in the /var/www/ folder, as CentOS treats all files within /var/www/ as open to the public, so dangerous. Link to answer.

Community
  • 1
  • 1
synthrom
  • 430
  • 6
  • 11