You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Between execution of normalize_template_location! and the return of options[:template_location], another thread could have executed the same function and executed the 'ensure' block, restoring this value to its single-string form before this method returns.
If you're going to restore its value, consider refactoring normalize_template_location! into a function that simply returns an array, and use that here instead.
The text was updated successfully, but these errors were encountered:
def test_template_location_array_with_threads
set_plugin_opts :template_location => template_loc
threads = []
1000.times do
threads << Thread.new do
1000.times do
assert_equal [[template_loc, tempfile_loc]], Sass::Plugin.template_location_array
end
end
end
threads.each { |t| t.join }
end
This fairly reliably fails with the existing code, and passes consistently with PR #1837.
We are getting this error very rarely:
It's possible the problem is a race condition when executing in a multi-threaded environment. In lib/sass/plugin/configuration.rb:
Between execution of
normalize_template_location!
and the return ofoptions[:template_location]
, another thread could have executed the same function and executed the 'ensure' block, restoring this value to its single-string form before this method returns.If you're going to restore its value, consider refactoring
normalize_template_location!
into a function that simply returns an array, and use that here instead.The text was updated successfully, but these errors were encountered: