This project is archived and is in readonly mode.
Strange behaviour in exception display
-
Karl Alexandre
- No changes were found…
-
Santiago Pastorino
- Assigned user set to Santiago Pastorino
Karl Alexandre, i have tried your application with the latest rails code from github and works as expected.
Please get a fresh copy from github, generate the application copy your models, views, controllers, routes and try it again.
Then we can close this issue.
Thanks. -
Karl Alexandre
Santiago,
I bundled edge rails and still have the problem somehow.
The first request (step2) renders the exception, all the following render a 500.
The log file for two requests is attached.Karl.
-
Santiago Pastorino
Karl, works for me tell me how you did your app.
You need to have the lastest rails from github and run ruby DIR_WHERE_YOU_HAVE_RAILS_REPO/bin/rails myapp --dev
And then start doing the routes, models, and all again.
Let me know.
-
Karl Alexandre
Santigo,
Run this script and tell me the result on your side.
Karl.
-
Santiago Pastorino
Ok i'm trying right now, try this one you.
-
Santiago Pastorino
Your patch doesn't apply cleanly on a fresh Rails edge generated app.
But try my app. -
Karl Alexandre
- Tag changed from actiondispatch, activerecord, exception to activerecord rails3, actiondispatch, activerecord, exception
Santiago,
Sorry for late reply,
In your app you have
Subitems.allin the controller, it works ok with it.
Now tryItem.first.subitems, it fails on the second request for me.
Strange thing is thatItem.first.subitems.allworks fine, butItem.first.subitemsfails.yours,
Karl. -
Steven Ringo
- Assigned user changed from Santiago Pastorino to Ryan Bigg
Just tried this with the following configuration:
ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.2.0]
Rails 3.0.0.beta3Works as expected and yields:
undefined methodsubitems' for nil:NilClass -
Karl Alexandre
Steven,
It seems you don't have the database populated with at least one item. Did you run rake db:seed ? -
Ryan Bigg
I did this and I get:
uninitialized constant ActionView::CompiledTemplates::Boum. No 500 page, just a standard white-and-grey error page. -
Karl Alexandre
Ryan,
The first request is always OK. Try two requests in a row, and tell me the result of the second one.I'm digging deeper and what I see now is that
ActionDispatch::ShowExceptions::render_exceptiongoesFAILSAFEwhile rendering this exception for the second time. -
Ryan Bigg
Multiple requests works for me, I'm interested as to how you can replicate this issue.
-
Anil Wadghule
yeah it is an issue. See here http://pastie.org/937107. When you start server you get proper error page with exception. On second request you get "500 Internal Server Error"
-
Karl Alexandre
Anil,
I don't get this exact trace, but that's the point.
Two interresing points :
- First, the association gets loaded even if not used (in my example), - Second, the exception fire two times as expected, but the middleware goes fail safe with can't dup nil class on the second rendering (may be something to do with template compiler ?) -
Karl Alexandre
All,
The cause of the problem is that
_request_and_response.erbtemplate inspects the current controller throughtrequest.env["action_controller.instance"]In my example app this reference the
@subitemsinstance variable.If I prevent this to happen by adding
<%@request.env.delete("action_controller.instance")%>to_request_and_response.erb, everything goes fine.Why all this lead to a
can't dup nil classinActiveRecord::Base.scoped_methods(Cause of the 500) ? To be continued... -
Jeremy Kemper
- Milestone cleared.
- State changed from new to open
-
Dan Pickett
- Tag changed from activerecord rails3, actiondispatch, activerecord, exception to activerecord rails3, actiondispatch, activerecord, bugmash, exception
Can a bugmasher reproduce this behavior?
-
Rohit Arondekar
I too got a 500 Internal Server Error by following the steps provided by Karl.
I created a gist of the rails server output => http://gist.github.com/401967 -- Note that I have demarcated the logs of the two requests. Before the " Started GET "/subitems/index" " of the second request a error is shown as follows:
Error during failsafe response:
ActionView::Template::Error (can't dup NilClass) in /home/rohit/.rvm/gems/ruby-1.9.2-head/gems/actionpack-3.0.0.beta3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb:Also by switching to Subitem.all the 500 error doesn't appear.
-
Rohit Arondekar
Forgot to mention my environment:
Ubuntu 10.04
ruby 1.9.2dev (2010-05-08 trunk 27665) [x86_64-linux]
Rails 3.0.0.beta3 -
Anil Wadghule
verified
See pasties for info about the logs
https://gist.github.com/2cc2371975ade98b85e5
http://pastie.org/937107Environment:
Macbook Pro Snow Leopard
ruby-1.8.7-p249 [ x86_64 ]
Rails 3 master branch "a0621c1086165e4b3cff71b54f08a190851b6314"Attached is rails app with which this bug is reproducible.
-
Gavin Stark
This is happening, I believe, because in ActiveRecord::Base
def scoped_methods #:nodoc: key = :"#{self}_scoped_methods" Thread.current[key] = Thread.current[key].presence || self.default_scoping.dup endOn the second request self.default_scoping is nil as opposed to []. This causes an exception trying to dup nil. However, I cannot see what is setting the default_scoping to nil
-
Jonas Huckestein
I had the same problem when using Tyler Kovac's HyperBase with is a subclass of ActiveRecord::Base.
default_scoping is defined as a class_inheritable_accessor in base.rb. It gets initialized in ActiveRecord::Base and HyperBase wasn't able to see the default value. Adding "self.default_scoping = self.superclass.default_scoping" to HyperBase resolved the situation. I'm not sure if that is a smart fix, though. It is my understanding that this is the intende behavior of class_inheritable_accessor.
What I don't understand is why most ActiveRecord::Base subclasses to see the default value for default_Scoping (which is []). Can somebody from the team explain how that works?
This problem was killing me, hope I could help a little bit.
-
Rohit Arondekar
- Importance changed from to High
I can't reproduce this on Rails 3 RC, can somebody else give a try?
-
Len Smith
Can't reproduce on Safari, Chrome or Firefox on OSX, Rails 3.0.0 and ruby 1.9.2p0.
-
Rohit Arondekar
- State changed from open to resolved
I think this issue got resolved along the way. I'm going to go ahead and close. If anybody still faces this issue just leave a comment and I'll reopen it.
-
Andrea Campi
- Assigned user changed from Ryan Bigg to Rohit Arondekar
Just a reminder you said you would close this :)
-
Rohit Arondekar
Andrea, the ticket is already closed as 'resolved'. :)
-
yoyogo
oh my!! i love you so much!!
Thank you so much.
Hermes Bags
http://www.louisvuittonparty.com/
Hermes Bags -
ssupreme11
Its my first time to visit this site and as I was exploring I cant believe that this site was made up of a very informative articles that you should try to have compliment with so as what I am doing now I really love to look forward with more interesting information on this site..
Regards,
Dissertation Proposal
