2

There's a method in my Rails app (intended to be triggered via Rake task) that shells out and runs a PhantomJS process:

bin/proximo bin/phantomjs vendor/assets/javascripts/yslow.js http://www.example.com

The phantomjs executable is 1.8.1 or Linux (x86-64). yslow.js is YSlow for PhantomJS 3.1.1.

The process is run through Heroku's Proximo add-on, because the website I'm running this against (example.com above) will show anti-DOS protection page to any IP that's not whitelisted.

The problem I'm experiencing is that this command simply hangs, returning no output. If I run the same command without executing the bin/proximo wrapper script, it works, but of course I get output for the wrong page, due to the IP restriction mentioned above.

Here is a stack trace from running this directly in a Rails console on Heroku:

irb(main):023:0> `bin/proximo bin/phantomjs vendor/assets/javascripts/yslow.js http://www.example.com`
^CIRB::Abort: abort then interrupt!
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb:7:in `call'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
  from /app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.11/lib/active_support/core_ext/kernel/agnostics.rb:7:in ``'
  from (irb):23
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
  from /app/vendor/bundle/ruby/1.9.1/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
  from script/rails:6:in `require'
  from script/rails:6:in `<main>'

Any ideas what's causing the hang?


Edit: My coworker helped me discover that it's actually PhantomJS that's hanging, not the proxy. I'll look for another way of vendoring PhantomJS, unless someone else has another suggestion.

Edit 2: I installed PhantomJS with the Heroku buildpack, and the same thing happens. I also notice that if I connect to a Bash shell on Heroku and run the phantomjs console, I can't enter commands in it because the enter key does nothing. Not sure if that's related...

Jimmy
  • 35,686
  • 13
  • 80
  • 98

0 Answers0