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

Fix thread safety of Sprockets::CachedEnvironment and Sprockets::Cache::MemoryStore #771

Merged
merged 6 commits into from
Dec 20, 2022

Commits on Dec 19, 2022

  1. Make Sprockets::CachedEnvironment thread-safe by using Concurrent::Map

    * Unfortunately this on its own does not work yet due to Sprockets
      recursively calling Sprockets::CachedEnvironment#load.
    * Reproduce the recursion issue with:
      bundle exec bin/sprockets -I test/fixtures/asset $PWD/test/fixtures/asset/application.js
    eregon committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    2d454bc View commit details
    Browse the repository at this point in the history
  2. Use Concurrent::Map#fetch_or_store

    * This does not hold any lock while computing the missing key,
      so avoids the problem of having a lock while recursing when
      using #compute_if_absent.
    * As the docs say:
      https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/Map.html#fetch_or_store-instance_method
      "The store can overwrite other concurrently stored value.".
      Which was already possibly before, Hash#fetch does not have the
      guarantee to execute the block only once per key, even on CRuby.
    eregon committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    4e74e3a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    9d461f1 View commit details
    Browse the repository at this point in the history
  4. Add ChangeLog entry

    eregon committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    d503c9b View commit details
    Browse the repository at this point in the history
  5. Add TruffleRuby in CI

    * This should help catching concurrency issues much faster.
    * Notably, the two issues of rails#772 reproduce by running the test suite on TruffleRuby.
    * Skip tests which do not pass yet on TrufffleRuby.
      oracle/truffleruby#2810
    eregon committed Dec 19, 2022
    Configuration menu
    Copy the full SHA
    58eb15d View commit details
    Browse the repository at this point in the history

Commits on Dec 20, 2022

  1. Make the URI tests pass with ruby-head

    * host is "" instead of nil, following the upstream change:
      ruby/uri@81263c9
    eregon committed Dec 20, 2022
    Configuration menu
    Copy the full SHA
    39490de View commit details
    Browse the repository at this point in the history