Note that there are some explanatory texts on larger screens.

plurals
  1. PORails view ivars spontaneously combusting in ruby 1.9
    primarykey
    data
    text
    <p>I have a Rails 3 / ruby 1.9.2 webapp. Every so often - and it might only be 1 request in 100000 - I get an error report that I can't explain.</p> <p>The exact error varies, but they seem to be along the lines of having an instance variable in my view suddenly become nil. The clearest instance of this occurred recently, where this code in a helper -</p> <pre><code> @swf_object_count||=0 @swf_object_count+=1 </code></pre> <p>- raised "NoMethodError: undefined method `+' for nil:NilClass". However, note that the errors are not limited to this case, and these two lines of code are meant only for illustration, not as something that can be worked around to 'solve' the problem.</p> <p>The error is basically impossible to reproduce : I have never seen it myself, only seen the error reports resulting from it. I believe the error first appeared when we switched from REE to ruby 1.9.2.</p> <p>Miscellaneous details that may or may not be relevant: </p> <ul> <li>We're running ruby1.9.2p290 on Solaris 10, using unicorn forked instances</li> <li>We're not using threads or fibers (correction: our app itself doesn't, but we do use NewRelic, which has a background thread for collecting/posting stats.)</li> <li>We have a mix of .haml &amp; .erb views, but I've only ever seen this occur from .haml. (We don't have many .erbs, though)</li> <li>I've never seen this occur in controller code</li> <li>I've occasionally seen errors regarding "undefined method 'foomethod' for Bar", when I know for a fact that we never call Bar.foomethod. It might be possible that this is related to the bug described above, where a Bar object spontaneously replaced a Foo ivar.</li> </ul> <p>I'm pretty stumped on tracking this down. Any suggestions, or has anyone seen anything that sounds similar?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload