简体   繁体   中英

Issue with Passenger, nginx and Rails3

I'm running nginx and passenger to host a Rails 3.2.22 site. It was working just fine up until recently, but the latest deploy has stumbled across some sort of bug.

nginx/passenger won't start up properly due to the following error:

App 1542 stderr: /var/lib/gems/1.9.1/gems/actionpack-3.2.22/lib/action_view/helpers/form_options_helper.rb:156:in `select'
App 1542 stderr: :
App 1542 stderr: wrong number of arguments (1 for 3)
App 1542 stderr:  (
App 1542 stderr: ArgumentError
App 1542 stderr: )
App 1542 stderr:        from /var/lib/gems/1.9.1/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/request_handler.rb:483:in `wait_until_termination_requested'
App 1542 stderr:        from /var/lib/gems/1.9.1/gems/passenger-5.0.23/src/ruby_supportlib/phusion_passenger/request_handler.rb:202:in `main_loop'
App 1542 stderr:        from /var/lib/gems/1.9.1/gems/passenger-5.0.23/src/helper-scripts/rack-preloader.rb:159:in `<module:App>'
App 1542 stderr:        from /var/lib/gems/1.9.1/gems/passenger-5.0.23/src/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
App 1542 stderr:        from /var/lib/gems/1.9.1/gems/passenger-5.0.23/src/helper-scripts/rack-preloader.rb:29:in `<main>'

It looks like Passenger is calling an action_view helper for 'select', for reasons I don't understand. The action_view helper at line 156 looks as follows:

def select(object, method, choices, options = {}, html_options = {})
  InstanceTag.new(object, method, self, options.delete(:object)).to_select_tag(choices, options, html_options)
end

The caller in passenger (request_helper line 483) looks like this:

ios = select([@owner_pipe, @graceful_termination_pipe[0]])[0]

Which is most likely a completely different 'select' call. I can't figure out why passenger is invoking the call for the ActionView helper (which is a form select).

It turns out the issue was related to my use of embedded ruby and Resque jobs. I have a delayed-execution job which performs a piece of work based on an ERb template. In order to be able to access some of the ERb helper methods, I included the following code:

include ActionView::Helpers

Unfortunately, I'd put this at the top of the file (similar to require ) instead of inside the Generator class. Moving the statement inside the class definition resolved the problem.

It would appear that Passenger was including the job file (even though it was in a separate app/jobs directory and only really for use by Resque ) and this was playing havoc with some of the Passenger function definitions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM