Resolver concurrency fix #6425

Merged
merged 2 commits into from May 21, 2012

Conversation

Projects
None yet
2 participants
Contributor

pinetops commented May 21, 2012

Replacement for #6412

This is a fix for #6404

The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This includes two commits, the first puts a global lock around the whole process.
The second improves this to add a more granular lock.

pinetops added some commits May 20, 2012

@pinetops pinetops Make the Resolver template cache threadsafe - closes #6404
The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
685192b
@pinetops pinetops More granular locking of the Resolver template cache
In order to avoid holding a global lock when doing template
resolution, instead add individual locks on a per cache entry
basis. The global lock is now only used for manipulation of the main
cache data structure.
719b008

@tenderlove tenderlove added a commit that referenced this pull request May 21, 2012

@tenderlove tenderlove Merge pull request #6425 from pinetops/resolver_concurrency_fix
Resolver concurrency fix
254c042

@tenderlove tenderlove merged commit 254c042 into rails:master May 21, 2012

@josevalim josevalim added a commit that referenced this pull request May 21, 2012

@josevalim josevalim Revert "Merge pull request #6425 from pinetops/resolver_concurrency_fix"
This reverts commit 254c042, reversing
changes made to 513a052.
776ea10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment