Rails see ivars spontaneously burned in ruby ​​1.9

I have a Rails 3 / ruby ​​1.9.2 webapp. Every so often - and it could be only 1 request per 100,000 - I get an error message that I cannot explain.

The exact error is changing, but they seem to coincide with the fact that the instance variable in my view suddenly becomes null. The most striking example of this happened recently, where this code in the helper is

 @swf_object_count||=0
 @swf_object_count+=1

- raised the NoMethodError: undefined `+ 'method for nil: NilClass". However, note that the errors are not limited to this case, and these two lines of code are for illustration only, and not as something that can be solved to "solve "problem.

The error, in principle, is impossible to reproduce: I never saw it, I saw only error messages. I believe that the error first appeared when we switched from REE to ruby ​​1.9.2.

Miscellaneous information that may or may not be relevant:

  • We run ruby1.9.2p290 on Solaris 10 using forked unicorn instances.
  • We do not use threads or fibers (correction: our application by itself does not work, but we use NewRelic, which has a background thread for collecting / publishing statistics).
  • We have a combination of .haml and .erb views, but I only saw that it comes from .haml. (We don’t have many.)
  • I have never seen this happen in controller code.
  • undefined "foomethod" Bar ", , Bar.foomethod. , , , Foo ivar.

. , - - ?

+5
2

- , . hmm... ?

.

, script , / . , , , , , .

, Unicorn , . . -, - , , , .

, , Rails . , , .

: Gem Gemfile:

# Receive exception notifications from production
gem 'exception_notification_rails3', :require => 'exception_notifier'

config/environment/production.rb:

  config.middleware.use ExceptionNotifier,
    :email_prefix => "[Exception] ",
    :sender_address => %{"Exception Notifier" <your-system@your-domain.com>},
    :exception_recipients => %w{person1@your-domain.com person2@your-domain.com}

. :   https://github.com/railsware/exception_notification

0

ivars - . , concurrency, , , , -.

, , , -

@swf_object_count + swf_increment_helper_value

0

All Articles