aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/concurrency
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Prevent deadlocks with load interlock and DB lock.Brent Wheeldon2017-11-091-0/+17
| | | | | | | | | | This fixes an issue where competing threads deadlock each other. - Thread A holds the load interlock but is blocked on getting the DB lock - Thread B holds the DB lock but is blocked on getting the load interlock (for example when there is a `Model.transaction` block that needs to autoload) This solution allows for dependency loading in other threads while a thread is waiting to acquire the DB lock. Fixes #31019
* [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Remove deprecated class ActiveSupport::Concurrency::LatchAndrew White2016-11-141-25/+0
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-1/+1
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-17/+17
|
* applies new string literal convention in activesupport/libXavier Noria2016-08-062-3/+3
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #25344 from matthewd/debug-locksMatthew Draper2016-07-021-5/+45
|\ | | | | ActionDispatch::DebugLocks
| * Provide a middleware to debug misbehaving locksMatthew Draper2016-06-101-5/+45
| | | | | | | | | | Only intended to be enabled when in use; by necessity, it sits above any reasonable access control.
* | Merge pull request #24146 from matthewd/latch-as-proxyMatthew Draper2016-07-021-5/+12
|\ \ | |/ |/| Don't inherit from Concurrent::CountDownLatch
| * Don't inherit from Concurrent::CountDownLatchMatthew Draper2016-03-111-5/+12
| | | | | | | | | | | | | | | | | | | | | | That class mangles .new, which interferes with our deprecation warning. More generally, it suggests we shouldn't be subclassing without a very good reason, and avoiding one allocation doesn't seem to meet that criteria. In passing, recommend the simpler Concurrent::Event for the common count=1 case.
* | Share lock: more accurate livelock fix for aa598f4Jeremy Daer2016-04-241-3/+2
| | | | | | | | | | | | | | | | Awaken waiting threads even if the current thread (the previously exclusive thread) hadn't taken a share lock. This only happens in code that wasn't run within an executor, since that always take an outermost share lock.
* | Share lock: avoid livelock due to exclusive thread sleeping before waiting ↵Jeremy Daer2016-04-231-0/+1
|/ | | | threads wake
* Manual yield doesn't block new sharesMatthew Draper2016-02-081-5/+6
|
* Eagerly reacquire when start_sharing is nested inside yield_sharesMatthew Draper2016-02-081-11/+18
| | | | A full write-preferring wait can lead to deadlock.
* Hand off the interlock to the new thread in AC::LiveMatthew Draper2016-02-071-15/+33
| | | | | | Most importantly, the original request thread must yield its share lock while waiting for the live thread to commit -- otherwise a request's base and live threads can deadlock against each other.
* After completing a load, give other threads a chance tooMatthew Draper2016-02-021-12/+26
| | | | | | | | | While we know no user code is running, we should do as much loading as we can. That way, all the threads will then be able to resume running user code together. Otherwise, only the last arriving thread would get to do its load, and would then return to userspace, leaving the others still blocked.
* While new sharers are blocked, an existing sharer remains re-entrantMatthew Draper2016-02-021-1/+1
|
* Block new share attempts if there's an exclusive waiterMatthew Draper2016-02-021-8/+12
|
* Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-041-2/+2
|
* Handle thread death during lock acquisitionMatthew Draper2015-07-211-4/+6
| | | | | | Specifically, clean up if the thread is killed while it's blocked awaiting the lock... if we get killed on some other arbitrary line, the result remains quite undefined.
* Adjust expectations around purpose/compatibility optionsMatthew Draper2015-07-211-1/+1
|
* Order of execution is only guaranteed if upgradingMatthew Draper2015-07-211-1/+1
| | | | | If the thread isn't yet holding any form of lock, it has no claim over what may / may not run while it's blocked.
* Fix ShareLock issues.thedarkone2015-07-201-2/+2
|
* We need stricter locking before we can unloadMatthew Draper2015-07-201-27/+29
| | | | | | | | | | | | Specifically, the "loose upgrades" behaviour that allows us to obtain an exclusive right to load things while other requests are in progress (but waiting on the exclusive lock for themselves) prevents us from treating load & unload interchangeably: new things appearing is fine, but they do *not* expect previously-present constants to vanish. We can still use loose upgrades for unloading -- once someone has decided to unload, they don't really care if someone else gets there first -- it just needs to be tracked separately.
* Replaced `ActiveSupport::Concurrency::Latch` with concurrent-ruby.Jerry D'Antonio2015-07-131-16/+8
| | | | | | | | | | The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
* Document ShareLock and the InterlockMatthew Draper2015-07-091-0/+20
|
* Soften the lock requirements when eager_load is disabledMatthew Draper2015-07-091-0/+118
| | | | | We don't need to fully disable concurrent requests: just ensure that loads are performed in isolation.
* added live responses which can be written and read in separate threadsAaron Patterson2012-07-291-0/+27