-
Notifications
You must be signed in to change notification settings - Fork 136
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
Issue with rails 2.3.14 #82
Comments
hey @leenasn, thanks for reporting. unfortunately, this issue seems a bit weird and I'm somehow unable to reproduce it on a simple 2.3.14 app. most likely it's going to be something about I have tried reproducing on https://github.com/jruby/jruby-rack/tree/master/examples/rails
|
Sorry for being late in my reply. I was getting this for the first request that hits the server. I am using bundler for my app thats the difference I could see between the rails example and my app. Not sure whether that will make any difference. |
I think bundler does not matter, to fix this we need to be able to reproduce it. Either you provide us with a minimal rails/sinatra app where this does happen or we need more input from you as I already mentioned in the previous comment - try to monkey patch the |
I ran into this issue with a warbled redmine (1.3-stable, requires rails 2.3.14) and jruby 1.6.5.1. I wasn't able to use a warbled war in tomcat 6.0.33 until reverting jruby-rack from 1.1.x to 1.0.10 and re-warbling. I'm not much of a ruby coder so I can't help with a minimal example. |
could someone please print that exception from the rescue block - would most probably be a time saver for us trying to reproduce. here's what I'm talking about - notice the added require 'action_controller/params_parser'
module ActionController
class ParamsParser
def parse_formatted_parameters(env)
request = Request.new(env)
return false if request.content_length.zero?
mime_type = content_type_from_legacy_post_data_format_header(env) || request.content_type
strategy = ActionController::Base.param_parsers[mime_type]
return false unless strategy
case strategy
when Proc
strategy.call(request.raw_post)
when :xml_simple, :xml_node
body = request.raw_post
body.blank? ? {} : Hash.from_xml(body).with_indifferent_access
when :yaml
YAML.load(request.raw_post)
when :json
body = request.raw_post
if body.blank?
{}
else
data = ActiveSupport::JSON.decode(body)
data = {:_json => data} unless data.is_a?(Hash)
data.with_indifferent_access
end
else
false
end
rescue Exception => e # YAML, XML or Ruby code block errors
puts "parse_formatted_parameters(env) #{env.inspect}"
puts "exception: #{e.message} (#{e.class})"
e.backtrace.each { |t| puts t }
logger.debug "Error occurred while parsing request parameters.\nContents:\n\n#{request.raw_post}"
raise
{ "body" => request.raw_post,
"content_type" => request.content_type,
"content_length" => request.content_length,
"exception" => "#{e.message} (#{e.class})",
"backtrace" => e.backtrace }
end
end
end |
placed above patch in config/initializers/mp.rb, re-warbled and started application. Pull following data from logs:
|
@tkunicki thanks a lot, appreciate it unfortunately, seems I expected too much to inspect the request environment on line 38 : could you maybe run it once more with line 38 commented - I was really hoping to reach the following lines where it seems that |
Here is the log entry with line 38 commented out:
|
confirming this is definitely an incorrectly loaded rack issue attempted to be fixed with 1cca795 |
I ran into this issue too and I've confirmed that the latest version of jruby-rack in git fixes the problem. Thanks! Here's an example for anyone else that runs into this issue https://github.com/johndouthat/jruby-rack-issue-82 |
I am getting the following error when I run the app with latest trinidad server.
undefined method 'raw_post' for nil:NilClass org/jruby/RubyKernel.java:238:in 'method_missing' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/activesupport-2.3.14/lib/active_support/whiny_nil.rb:52:in 'method_missing' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/params_parser.rb:50:in 'parse_formatted_parameters' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/params_parser.rb:11:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/session/cookie_store.rb:99:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/failsafe.rb:26:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/rack-1.1.3/lib/rack/lock.rb:11:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:114:in 'call' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/reloader.rb:34:in 'run' /mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/actionpack-2.3.14/lib/action_controller/dispatcher.rb:108:in 'call' file:/mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/jruby-rack-1.1.2/lib/jruby-rack- 1.1.2.jar!/rack/adapter/rails.rb:36:in 'serve_rails' file:/mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/jruby-rack-1.1.2/lib/jruby-rack-1.1.2.jar!/rack/adapter/rails.rb:52:in 'call' file:/mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/jruby-rack-1.1.2/lib/jruby-rack-1.1.2.jar!/jruby/rack/rails.rb:186:in 'call' file:/mnt/cc/installables/jruby-1.6.5.1/lib/ruby/gems/1.8/gems/jruby-rack-1.1.2/lib/jruby-rack-1.1.2.jar!/rack/handler/servlet.rb:20:in 'call'
And as a fix I downgraded the jruby-rack version to 1.0.10 and now it works fine. Any patch to make it work with rails 2.3?
The text was updated successfully, but these errors were encountered: