diff options
author | Håvard Pettersen <havardpe@oath.com> | 2020-06-14 11:43:34 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2020-06-14 11:43:34 +0000 |
commit | bfc6cfee7ea0dc4b8746573ab6e18fc5941c59c2 (patch) | |
tree | ede34221ac36f440de4fb0ba600bfab1a8f9be19 /vespalib | |
parent | aacb857c63b9932ecac330d65bdd28d05d458b62 (diff) |
avoid deadlock when using compile cache with blocking executors
- avoid taking cache lock in compile task destructor
- avoid holding cache lock while posting compile task
- add unit test trying to provoke deadlock
- bonus: fix blocking executor implementation
(did not work with threads <= task limit)
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp index efb1dbf4054..ad5d78d5ab6 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.cpp @@ -87,6 +87,7 @@ ThreadStackExecutorBase::obtainTask(Worker &worker) if (!worker.idle) { assert(_taskCount != 0); --_taskCount; + wakeup(monitor); _barrier.completeEvent(worker.task.token); worker.idle = true; } @@ -96,7 +97,6 @@ ThreadStackExecutorBase::obtainTask(Worker &worker) worker.task = std::move(_tasks.front()); worker.idle = false; _tasks.pop(); - wakeup(monitor); return true; } if (_closed) { |