Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a deadlock when leader change if enable leader-only option. #390

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ func (o *ovsdbClient) connect(ctx context.Context, reconnect bool) error {
o.logger.V(3).Info("reconnected - restarting monitors")
for dbName, db := range o.databases {
db.monitorsMutex.Lock()
defer db.monitorsMutex.Unlock()

// Purge entire cache if no monitors exist to update dynamically
if len(db.monitors) == 0 {
db.cache.Purge(db.model)
db.monitorsMutex.Unlock()
continue
}

Expand All @@ -299,9 +299,11 @@ func (o *ovsdbClient) connect(ctx context.Context, reconnect bool) error {
err := o.monitor(ctx, MonitorCookie{DatabaseName: dbName, ID: id}, true, request)
if err != nil {
o.resetRPCClient()
db.monitorsMutex.Unlock()
return err
}
}
db.monitorsMutex.Unlock()
}
}

Expand Down
Loading