Skip to content
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

Freezable triggers on external objects when using fibers #109

Open
utay opened this issue Apr 11, 2024 · 0 comments
Open

Freezable triggers on external objects when using fibers #109

utay opened this issue Apr 11, 2024 · 0 comments

Comments

@utay
Copy link

utay commented Apr 11, 2024

Because thread_mattr_accessor uses Thread.current[], doing self.prevent_instance_data_manipulation_after_freezing = false in the Object extension doesn't work when using fibers (it defaults to true). FWIW discussions in rails/rails#19693 seem related.

In our case we set config.active_support.isolation_level = :fiber in the Rails config.

For instance:

/usr/local/bundle/gems/console1984-0.1.31/lib/console1984/freezeable.rb:42:in `block in prevent_sensitive_method': You can't invoke instance_variable_get on #<ActiveRecord::Reflection::RuntimeReflection:0x00007fb3f5340700> (Console1984::Errors::ForbiddenCommandAttempted)
        from /usr/local/bundle/bundler/gems/activerecord-jsonb-associations-dde23b72bdb7/lib/activerecord/jsonb/associations/association_scope.rb:7:in `last_chain_scope'
        from /usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/associations/association_scope.rb:125:in `add_constraints'
        from /usr/local/bundle/gems/activerecord-7.1.3/lib/active_record/associations/association_scope.rb:29:in `scope'

Any reason to use thread_mattr_accessor in this case versus mattr_accessor?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant