aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/concurrent
Commit message (Collapse)AuthorAge
* Automatic code cleanup.Gravatar cushon2017-09-15
| | | | PiperOrigin-RevId: 168802886
* Migrate Java tests to Truth.Gravatar lberki2017-05-30
| | | | | | RELNOTES: None. PiperOrigin-RevId: 157446717
* Clean up AbstractQueueVisitor's constructors.Gravatar janakr2017-05-09
| | | | | | | | The "concurrent" bit was supposedly around for testing purposes, but who knows if it even works anymore. Making other callsites explicitly state their ErrorClassifier gets us down to two constructors, one of which can delegate to the other. I think having both these constructors is useful because there's a linkage between creating a new executor service and specifying that the AQV should shut down the service at the end of the visitation. And using a static create() method doesn't work because of AQV's inheritance model. PiperOrigin-RevId: 155406771
* Replace the fancy, lockless, and incorrect BoundedMultisetSemaphore and with ↵Gravatar Nathan Harmata2017-02-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | a boring naive synchronized implementation. There's a race condition in my design of the lockless data structure. I haven't been able to come up with a lockless algorithm that actually works, and the naive one seems to be fine. In Blaze's usage, performance actually isn't super important so the naive implementation is fine. Consider three threads and a MultisetSemaphore with 2 max unique values. T1: acquireAll({a, b}) T2: acquireAll({a, c}) T3: acquireAll({a, d}) For the for-loop before the 'acquire' call, suppose: -T1 wins the race to acquire 'a' [1] and also wants to acquire 'b' [1] -T2 loses the race to acquire 'a' [2] and also wants to acquire 'c' [1] -T3 loses the race to acquire 'a' [2] and also wants to acquire 'd' [1] So then in [3] we have: -T1 tries to acquire 2 permits -T2 tries to acquire 1 permit -T3 tries to acquire 1 permit Suppose the execution order in [3] is T2, T3, T1. So that means we then have T1 still at [3] and both T2 and T3 at [4], which is a deadlock. [1] https://github.com/bazelbuild/bazel/blob/fa96b04f6c8ca6b6b3464727672267133e852959/src/main/java/com/google/devtools/build/lib/concurrent/MultisetSemaphore.java#L184 [2] https://github.com/bazelbuild/bazel/blob/fa96b04f6c8ca6b6b3464727672267133e852959/src/main/java/com/google/devtools/build/lib/concurrent/MultisetSemaphore.java#L191 [3] https://github.com/bazelbuild/bazel/blob/fa96b04f6c8ca6b6b3464727672267133e852959/src/main/java/com/google/devtools/build/lib/concurrent/MultisetSemaphore.java#L199 [4] https://github.com/bazelbuild/bazel/blob/fa96b04f6c8ca6b6b3464727672267133e852959/src/main/java/com/google/devtools/build/lib/concurrent/MultisetSemaphore.java#L210 -- PiperOrigin-RevId: 148272171 MOS_MIGRATED_REVID=148272171
* Global cleanup change.Gravatar Googler2017-01-25
| | | | | | -- PiperOrigin-RevId: 145473478 MOS_MIGRATED_REVID=145473478
* Introduce MultisetSemaphore: A concurrency primitive for managing access to ↵Gravatar Nathan Harmata2016-11-10
| | | | | | | at most K unique things at once. -- MOS_MIGRATED_REVID=138684040
* Introduce MoreFutures#waitForAllInterruptiblyFailFast and use this in the ↵Gravatar Nathan Harmata2016-09-26
| | | | | | | | | places we wait for tasks (plural!) submitted to a ForkJoinPool to finish since we actually want to do so interruptibly. As was to be expected, testing this was tricky :) -- MOS_MIGRATED_REVID=134128019
* Allow Skyframe graph lookups and value retrievals to throw InterruptedException.Gravatar Janak Ramakrishnan2016-08-16
| | | | | | | The only place we now don't handle InterruptedException is in the action graph created after analysis, since I'm not sure that will be around for that much longer. -- MOS_MIGRATED_REVID=130327770
* Have AQV propagate the most severe error encountered by any of its tasks. ↵Gravatar Nathan Harmata2016-08-12
| | | | | | | | | Make sure that ParallelEvaluator treats SchedulerExceptions as less severe than other RuntimeExceptions (it already did, but add a comment emphasizing this). The combination of the above means that we don't ignore hypothetical crashes in ParallelEvaluator worker threads _after_ a SchedulerException (e.g. due to an error in nokeep_going evaluation). -- MOS_MIGRATED_REVID=130044230
* Typo fixes in markdown and javadoc as suggested by intellij typo inspection.Gravatar Googler2016-07-27
| | | | | -- MOS_MIGRATED_REVID=128476121
* Remove ability of AbstractQueueVisitor to continue after an interrupt. That ↵Gravatar Janak Ramakrishnan2016-06-15
| | | | | | | functionality was only used in tests. -- MOS_MIGRATED_REVID=124841573
* Allow AQV users to inject arbitrary handling of classified errors.Gravatar Nathan Harmata2016-05-27
| | | | | -- MOS_MIGRATED_REVID=123347295
* Cleanup AbstractQueueVisitorTest, simpleCounter in particularGravatar Mark Schaller2016-03-11
| | | | | | | | | | | | | | Second in a sequence of CLs to deflake #simpleCounter. The condition, commented out in a previous CL, was checking a property that wasn't deterministic. The maxRunningConcurrently could be either one or two depending on how quickly the AbstractQueueVisitor scheduled the runnables. Also added documentation to a confusing constructor call and removed dead code. -- MOS_MIGRATED_REVID=116995523
* Quick fix for AbstractQueueVisitorTest.simpleCounter test flakeGravatar Mark Schaller2016-03-09
| | | | | | | | First in a (probably short) sequence of commits to fix the flakiness of the #simpleCounter test. -- MOS_MIGRATED_REVID=116701149
* Allow AbstractQueueVisitor implementations to introspect on active worker ↵Gravatar Eric Fellheimer2016-03-04
| | | | | | | count and possibly use that value to make dynamic decisions around scheduling. -- MOS_MIGRATED_REVID=116351222
* Use Bazel Preconditions variant which avoids varargs array creationGravatar Mark Schaller2015-12-10
| | | | | | | Reduces garbage. -- MOS_MIGRATED_REVID=109914243
* Distinguish between read and write locks for KeyedLocker.Gravatar Janak Ramakrishnan2015-12-10
| | | | | -- MOS_MIGRATED_REVID=109835697
* Migrated tests in devtools/build/lib/concurrent to JUnit 4.Gravatar Florian Weikert2015-11-30
| | | | | -- MOS_MIGRATED_REVID=108983674
* Cleanup ValueVisitor (and dirty QuiescingExecutor)Gravatar Mark Schaller2015-11-02
| | | | | | | | | | | | | Raises the level of abstraction of ValueVisitor's dependence on AbstractQueueVisitor. Except for the "ForTestingOnly" methods now available on the QuiescingExecutor interface, ValueVisitor is agnostic to the implementation of its executor. This also cleans up the full spectrum of visibility modifiers on ValueVisitor methods, all of which ought to be private. -- MOS_MIGRATED_REVID=106847453
* Introduce ErrorClassifierGravatar Mark Schaller2015-11-02
| | | | | | | | | | Changes the AbstractQueueVisitor strategy for varying its response to unhandled exceptions from inheritance to composition. This will help with a forthcoming switch from inheritance to delegation for ValueVisitor's use of AbstractQueueVisitor. -- MOS_MIGRATED_REVID=106730708
* Introduce QuiescingExecutorGravatar Mark Schaller2015-11-02
| | | | | | | | | | | | This interface (mostly) encapsulates what the ValueVisitor expects from the AbstractQueueVisitor class it currently inherits from. This makes it easier for a future CL to change ValueVisitor's strategy of code reuse from inheritance to composition. RELNOTES: -- MOS_MIGRATED_REVID=106728863
* Process tasks in the AbstractQueueVisitor in LIFO order as opposed to FIFO ↵Gravatar Janak Ramakrishnan2015-10-22
| | | | | | | | | order. In general, there's no advantage in Blaze to FIFO, and it means that we effectively do breadth-first graph traversal. When we must hold state for incomplete nodes (as we do with action execution, or more generally, as we do in Skyframe), this increases our memory footprint. LIFO is not exactly depth-first traversal, since we are multithreaded, but to a first approximation, it looks like a depth-first traversal with "width" the number of threads (at each level of the graph, #(threads) nodes are visited). -- MOS_MIGRATED_REVID=105995014
* Don't log SchedulerExceptions.Gravatar Nathan Harmata2015-10-20
| | | | | | | RELNOTES: None -- MOS_MIGRATED_REVID=105787681
* Allow other ExecutorService implementations in AbstractQueueVisitorGravatar Mark Schaller2015-10-13
| | | | | | | Previously, only ThreadPoolExecutor implementations were allowed. -- MOS_MIGRATED_REVID=105340237
* Rationalize copyright headersGravatar Damien Martin-Guillerez2015-09-25
| | | | | | | | | | | The headers were modified with `find . -type f -exec 'sed' '-Ei' 's|Copyright 201([45]) Google|Copyright 201\1 The Bazel Authors|' '{}' ';'` And manual edit for not Google owned copyright. Because of the nature of ijar, I did not modified the header of file owned by Alan Donovan. The list of authors were extracted from the git log. It is missing older Google contributors that can be added on-demand. -- MOS_MIGRATED_REVID=103938715
* Don't allow subclasses of AQV to treat Errors as non-critical. Also update ↵Gravatar Nathan Harmata2015-09-16
| | | | | | | the documentation for AQV#work to reflect the semantics of critical errors. -- MOS_MIGRATED_REVID=103140100
* Add a new KeyedLocker, StripedKeyedLocker. This new implementation simply ↵Gravatar Eric Fellheimer2015-09-03
| | | | | | | stores a striped set of reentrant locks. -- MOS_MIGRATED_REVID=102198213
* Delete Batch locking, which is unused as of this CL.Gravatar Eric Fellheimer2015-08-12
| | | | | -- MOS_MIGRATED_REVID=100399962
* Rollback of commit 6f049bb19941b89d16364b26cca66aae09f9cb42.Gravatar Nathan Harmata2015-06-26
| | | | | | | | | | | | | *** Reason for rollback *** Ended up not being necessary; I was able to rephrase things using SettableFuture instead. *** Original change description *** Introduce a simple concurrent Multimap-like data structure with reference counting. -- MOS_MIGRATED_REVID=96884190
* Renaming ExecutorShutdownUtil to ExecutorUtil, since it doesn't just do ↵Gravatar Eric Fellheimer2015-06-19
| | | | | | | shutdown operations. -- MOS_MIGRATED_REVID=96351438
* Introduce a simple concurrent Multimap-like data structure with reference ↵Gravatar Nathan Harmata2015-06-16
| | | | | | | counting. -- MOS_MIGRATED_REVID=96024804
* Undo development-only change to the number of threads in test that ↵Gravatar Nathan Harmata2015-06-16
| | | | | | | mistakenly submitted. Also fix a now-exposed bug in the testing code: one of the helpers wasn't threadsafe. -- MOS_MIGRATED_REVID=96018858
* Introduce KeyedLocker#lockBatch, which does what it sounds like it does.Gravatar Nathan Harmata2015-04-06
| | | | | -- MOS_MIGRATED_REVID=90282858
* Some minor improvements to KeyedLocker:Gravatar Nathan Harmata2015-04-03
| | | | | | | | | | | (i) Change the semantics of KeyedLocker.AutoUnlocker#close such that it can be called at most once per AutoUnlocker instance. (ii) Change KeyedLocker.AutoUnlocker#close to throw a IllegalUnlockException (RuntimeException) on error, rather than leave the behavior intentionally underspecified. (iii) explicitly mention in AutoLocker#lock that a thread can call lock(k) multiple times before unlocking. Combined with (i), this implies that KeyedLocker#lock implementations will want to return fresh AutoUnlocker instances. These semantics are bit nicer to use anyway, but I also want them because I will soon be introducing KeyedLocker#lockBatch, and it's much easier to specify that given the above. -- MOS_MIGRATED_REVID=90259645
* Introduce KeyedLocker, a nice concurrency abstraction for managing lots of ↵Gravatar Nathan Harmata2015-03-10
| | | | | | | mutexes, and RefCountedMultisetKeyedLocker, an efficient implementation of this abstraction. -- MOS_MIGRATED_REVID=88000985
* Some more cleanup.Gravatar Ulf Adams2015-03-10
| | | | | -- MOS_MIGRATED_REVID=87942730
* Update from Google.Gravatar Han-Wen Nienhuys2015-02-25
-- MOE_MIGRATED_REVID=85702957