Commit 01a4ed14 authored by Michael Schurter's avatar Michael Schurter
Browse files

nomad: fix race in BlockedEvals

I assume the mutex was being released before sending on capacityChangeCh
to avoid blocking in the critical section, but:

1. This is race.
2. capacityChangeCh has a *huge* buffer (8096). If it's full things
   already seem Very Bad, and a little backpressure seems appropriate.
parent 59946ff7
Showing with 1 addition and 2 deletions
+1 -2
......@@ -450,10 +450,10 @@ func (b *BlockedEvals) UnblockQuota(quota string, index uint64) {
// be enqueued into the eval broker.
func (b *BlockedEvals) UnblockClassAndQuota(class, quota string, index uint64) {
b.l.Lock()
defer b.l.Unlock()
// Do nothing if not enabled
if !b.enabled {
b.l.Unlock()
return
}
......@@ -464,7 +464,6 @@ func (b *BlockedEvals) UnblockClassAndQuota(class, quota string, index uint64) {
b.unblockIndexes[quota] = index
}
b.unblockIndexes[class] = index
b.l.Unlock()
b.capacityChangeCh <- &capacityUpdate{
computedClass: class,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment