Failing to precompile assets on ARM devices (raspberry pi 2)+discussion

we have automated testing with semaphore.

 

It's not unusual for the first load to take a long time, because it's building a new compressed version of the javascript/css for your local environment.

 

what are your logs saying? Eg, when you go to /*all+*script+*machine_output.js in the browser?

 

--Ethan McCutchen.....2015-03-24 03:12:51 +0000

That one never finishes loading. It just sits there.

WAIT...

Going to: http://colaborare.local:3000/*all+*script+*machine_output.js

 Could not find "*all+*script+*machine output". 
--Mir S......2015-03-24 08:22:37 +0000

Started backtracking reinstalled everything from scratch, and locked to wagn 1.14.8 this was the first to produce any output in WEBrick. It first crashed with this:

 

removed for display purposes -> check history is you want to see the log

--Mir S......2015-03-24 09:43:22 +0000

The normal missing.js file in there. NOTE: I have Ruby 1.9.3-p194 even though the directory is named 1.9.1

 

Started GET "/" for 192.168.10.3 at 2015-03-24 09:37:47 +0000

Processing by CardController#read as HTML

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] saving /home/pi/test/files/1264/7325.js

Rendered text template (0.0ms)

Completed 200 OK in 10933.2ms (Views: 280.4ms | ActiveRecord: 630.6ms)

Started GET "/files/*all+*style+*machine_output-7322.css" for 192.168.10.3 at 2015-03-24 09:38:12 +0000

Processing by CardController#read as CSS

Parameters: {"explicit_file"=>true, "id"=>"*all+*style+*machine_output", "rev_id"=>"7322"}

Sent file /home/pi/test/files/1261/7322.css (0.5ms)

Completed 200 OK in 354.7ms (ActiveRecord: 10.5ms)

Started GET "/javascripts/missing.js" for 192.168.10.3 at 2015-03-24 09:38:12 +0000

Processing by CardController#asset as JS

Parameters: {"filename"=>"missing"}

Routing assets through Wagn. Recommend symlink from Deck to Wagn gem using 'rake wagn:update_assets_symlink'

Sent file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js (1.6ms)

exception = ActionController::MissingFile: Cannot read file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js

Rendered text template (0.0ms)

Completed 404 Not Found in 21.8ms (Views: 3.4ms | ActiveRecord: 0.0ms)

Started GET "/" for 86.35.221.151 at 2015-03-24 09:40:13 +0000

Started POST "/card/create/" for 192.168.10.3 at 2015-03-24 09:40:22 +0000

Processing by CardController#create as HTML

Parameters: {"utf8"=>"✓", "authenticity_token"=>"a2kR+uANBtUs8XgSOsmFJkbuEa75FMO03NrxJnVru88=", "success"=>"REDIRECT: /", "card"=>{"type_id"=>"4", "name"=>"xxx", "subcards"=>{"+*account+*email"=>{"content"=>"xxx", "type_id"=>"52"}, "+*account+*password"=>"[FILTERED]"}}, "setup"=>"true", "button"=>""}

Rendered text template (0.0ms)

Completed 422 Unprocessable Entity in 3457.9ms (Views: 4.0ms | ActiveRecord: 186.9ms)

Started GET "/javascripts/missing.js" for 192.168.10.3 at 2015-03-24 09:40:26 +0000

Processing by CardController#asset as JS

Parameters: {"filename"=>"missing"}

Routing assets through Wagn. Recommend symlink from Deck to Wagn gem using 'rake wagn:update_assets_symlink'

Sent file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js (0.9ms)

exception = ActionController::MissingFile: Cannot read file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js

Rendered text template (0.0ms)

Completed 404 Not Found in 19.8ms (Views: 4.0ms | ActiveRecord: 0.0ms)

Processing by CardController#read as HTML

Rendered text template (0.0ms)

Completed 200 OK in 3351.1ms (Views: 230.3ms | ActiveRecord: 59.7ms)

Started POST "/card/create/" for 192.168.10.3 at 2015-03-24 09:40:39 +0000

Processing by CardController#create as HTML

Parameters: {"utf8"=>"✓", "authenticity_token"=>"a2kR+uANBtUs8XgSOsmFJkbuEa75FMO03NrxJnVru88=", "success"=>"REDIRECT: /", "card"=>{"type_id"=>"4", "name"=>"xxx", "subcards"=>{"+*account+*email"=>{"content"=>"xxx", "type_id"=>"52"}, "+*account+*password"=>"[FILTERED]"}}, "setup"=>"true", "button"=>""}

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

[paperclip] Saving attachments.

Redirected to http://colaborare.local:3000/

Completed 302 Found in 6854.6ms (ActiveRecord: 952.8ms)

Started GET "/" for 192.168.10.3 at 2015-03-24 09:40:46 +0000

Processing by CardController#read as HTML

Rendered text template (0.0ms)

Completed 200 OK in 1696.9ms (Views: 66.6ms | ActiveRecord: 79.9ms)

Started GET "/javascripts/missing.js" for 192.168.10.3 at 2015-03-24 09:40:48 +0000

Processing by CardController#asset as JS

Parameters: {"filename"=>"missing"}

Routing assets through Wagn. Recommend symlink from Deck to Wagn gem using 'rake wagn:update_assets_symlink'

Sent file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js (0.8ms)

exception = ActionController::MissingFile: Cannot read file /var/lib/gems/1.9.1/gems/wagn-1.14.8/public/assets/missing.js

Rendered text template (0.0ms)

Completed 404 Not Found in 18.1ms (Views: 3.3ms | ActiveRecord: 0.0ms)

 

 

--Mir S......2015-03-24 09:46:17 +0000

I'm struggling to figure this out. I just tried a fresh install from 1.14.9 with no issues.

 

Perhaps this is a javascript runtime issue? You're not on a mac, right?

 

Try this:

 

1. edit your Gemfile,

2. uncomment this line:

> # gem 'therubyracer

3. run `bundle install`

4. get rid of all your tmp files (`rm -rf tmp/*`)

5. start browser again.

 

If that's the problem, we DEFINITELY need better error handling there!!

--Ethan McCutchen.....2015-03-24 15:55:20 +0000

I have something, I found a consistent way of crashing 'wagn server'. Isolated it to deleting the tmp folder and then starting 'wagn server'.

 

If I delete it and try to run the command it reliably crashes every time.

 

If I keep the tmp folder and run the command it reliably shows a page in which Javascript doesn't work. Whatever it's generating and putting in that tmp fails half way somehow and it crashes... next time you start it finds the tmp so it doesn't try to generate again but rather uses the botched data that is already there.

 

Here is the crash report (very long):


Oh god finally!

 

Managed to fix it. Apparently it's a known issue on the Raspberry Pi 2 with therubyracer.

More here:

http://stackoverflow.com/questions/29243824/ruby-on-raspberry-pi-2-with-raspbian-webrick-crash/29244506#29244506

 

Solution:

gem uninstall therubyracer

apt-get install nodejs

cd myapp

rm -rf tmp -remove your app's tmp folder

nano Gemfile -put a # before like that says "gem 'therubyracer'"

 

Restart the pi

Try to access it again, give it a little time, it has to recompile it's assets.

--Mir S......2015-03-25 03:15:15 +0000