rubyjs / therubyracer

Embed the V8 Javascript Interpreter into Ruby
1.67k stars 190 forks source link

V8 causing weak references in session objects #397

Closed hlascelles closed 8 years ago

hlascelles commented 8 years ago

We were recently running into issues where our session inspect calls were crashing with a WeakRef::RefError: Invalid Reference - probably recycled. (Specifically, it was being triggered by Devise https://github.com/plataformatec/devise/issues/3828).

A report of the class hierarchy yielded this:

self.class.ancestors = [ActionDispatch::Request::Session, Object, PP::ObjectMixin, V8::Conversion::Object, JSON::Ext::Generator::GeneratorMethods::Object, Kernel, BasicObject]

And sure enough the V8::Conversion::Object interloper was causing session objects to be unsafely garbage collected.

The only fix we found was to remove therubyracer altogether from deployed environments.

cowboyd commented 8 years ago

Without an explanation of why, it's unclear if this is an issue with therubyracer. My guess is that there is simply a method naming conflict between therubyracer and devise, but without a diagnosis it's impossible to tell.