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
I am unsure if there is a deadlock by upgrading the lock type of f.mu here. I don't see AddSeriesList called within the same scope as TagValueIterator. Shown by the following example https://goplay.tools/snippet/67evkRgdE9R the only way a deadlock occurs is when a.mu.RLock() is held and then a call in to a.two() is made. If the functions are called independently of each others scopes it does not deadlock.
Are you seeing:
fatal error: all goroutines are asleep - deadlock!
When this issue occurs, it seems that schema.measurementTagValues is called when a new series is added. In my running program, there was additional code that periodically checks tag values.
Could you check this condition?
To make it easier to reproduce the issue, I modified the Go code by adding a delay between the first and second RLock calls in TagValueIterator. Then, if one client inserts a new series while another client checks tag values, the issue occurs consistently.
Issue Summary
I suspect a potential deadlock related to the
TagValueIterator()
function when interacting withAddSeriesList()
.Possible Deadlock Scenario
The issue appears to arise due to conflicting RLock() and Lock() calls on f.mu within LogFile. Specifically:
TagValueIterator()
acquires anRLock()
onf.mu
.tk.TagValueIterator()
, which attempts to acquire anotherRLock()
ontk.f.mu
(which is the same asf.mu
).AddSeriesList()
is called and attempts to acquire a writeLock()
onf.mu
, whileRLock()
is still held.sync.RWMutex
does not allow acquiring aLock()
when anRLock()
is already held.Relevant Code
TagValueIterator()
(log_file.go
)tk.TagValueIterator()
(log_file.go
)AddSeriesList()
(log_file.go
)pprof Output When Deadlock Occurred
Currently, the only way to recover from this issue is to restart InfluxDB, which is problematic.
The text was updated successfully, but these errors were encountered: