Configurable
recursion tracking causes errors in multi-threaded environment
#2897
Milestone
Configurable
recursion tracking causes errors in multi-threaded environment
#2897
How to reproduce:
Configure a column in the list view with a
formatted_value
definition that takes a little longer to process.The longer it takes the more likely for the race-condition to show up. Run the admin panel in a multi-threaded environment, e.g. using
puma
inproduction
. Go to the respective list in the admin panel and stress it by reloading the page many times. The best thing is if you create two scopes and always click between the two.At some point you will get:
Cause:
The recursion tracking in the
Configurable
module, here.Doing
instance_variable_set("@#{option_name}_recurring", true)
is not thread-safe.@formatted_value_recurring
totrue
and then evaluates the proc.@formatted_value_recurring
istrue
and thus attempts to call the instance method of the model, which is not there.Solution:
Scope the recursion tracking variable to the request. This proof-of-concept uses RequestStore.
The key is not optimal but this proof-of-concept solves the bug on this page.
The text was updated successfully, but these errors were encountered: