You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a deadlock that can occur when writing points and dropping the measurement being written to concurrently.
The deadlock occurs due to out of order locking of the Engine and MeasurementFields lock. One goroutine (snapshotting the cache), acquires an RLock on the Engine and ends up needing to acquire an RLock on MeasurementFields to refresh the index. A second goroutine running a delete acquires a Lock on MeasurementFields after the first goroutine takes the EngineRLock. It subsequently tries take a Lock on the engine to disable compactions which blocks. Goroutine 1 then tries to acquire the RLock on MeasurementFields and they deadlock.
The OnReplace func ends up trying to acquire locks on MeasurementFields. When
its called via snapshotting, this can deadlock because the snapshotting goroutine
also holds an RLock on the engine. If a delete measurement calls is run at the
right time, it will lock the MeasurementFields and try to acquire a lock on the engine
to disable compactions. This creates a deadlock.
To fix this, the OnReplace callback is moved to a function param to allow only Replace
calls as part of a compaction to invoke it as opposed to both snapshotting and compactions.
Fixes#8713
The OnReplace func ends up trying to acquire locks on MeasurementFields. When
its called via snapshotting, this can deadlock because the snapshotting goroutine
also holds an RLock on the engine. If a delete measurement calls is run at the
right time, it will lock the MeasurementFields and try to acquire a lock on the engine
to disable compactions. This creates a deadlock.
To fix this, the OnReplace callback is moved to a function param to allow only Replace
calls as part of a compaction to invoke it as opposed to both snapshotting and compactions.
Fixes#8713
Bug report
Version: 1.3.3/master
There is a deadlock that can occur when writing points and dropping the measurement being written to concurrently.
The deadlock occurs due to out of order locking of the
Engine
andMeasurementFields
lock. One goroutine (snapshotting the cache), acquires anRLock
on theEngine
and ends up needing to acquire anRLock
onMeasurementFields
to refresh the index. A second goroutine running a delete acquires aLock
onMeasurementFields
after the first goroutine takes theEngine
RLock
. It subsequently tries take aLock
on the engine to disable compactions which blocks. Goroutine 1 then tries to acquire theRLock
onMeasurementFields
and they deadlock.The text was updated successfully, but these errors were encountered: