[PR #182] [MERGED] bugfix: fix double unlock of mutex in dealer recvloop #243

Closed
opened 2026-02-28 14:26:22 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/devgianlu/go-librespot/pull/182
Author: @skeller
Created: 4/23/2025
Status: Merged
Merged: 4/23/2025
Merged by: @devgianlu

Base: masterHead: fix_unlock


📝 Commits (1)

  • cb077cc bugfix: fix double unlock of mutex in dealer recvloop

📊 Changes

1 file changed (+5 additions, -4 deletions)

View changed files

📝 dealer/dealer.go (+5 -4)

📄 Description

On error on backoff retry an error message is logged and the mutex unlocked. It is unlocked again outside the error handling and the loop is not stopped (if the unlock wouldn't panic). Fix this by correctly terminating the loop / cleaning up.

Fixes this:
librespot-go-1 | time="2025-04-21T05:15:11Z" level=error msg="failed reconnecting dealer" error="failed obtaining dealer access token: failed renewing login5 access token: failed authenticating with login5: UNKNOWN_ERROR"
librespot-go-1 | fatal error: sync: Unlock of unlocked RWMutex
librespot-go-1 |
librespot-go-1 | goroutine 20295860 [running]:
librespot-go-1 | sync.fatal({0xb0da65?, 0x2e28ae00000003?})
librespot-go-1 | /usr/lib/go/src/runtime/panic.go:1007 +0x20
librespot-go-1 | sync.(*RWMutex).Unlock(0x40002be858)
librespot-go-1 | /usr/lib/go/src/sync/rwmutex.go:208 +0x74
librespot-go-1 | github.com/devgianlu/go-librespot/dealer.(*Dealer).recvLoop(0x40002be7e0)
librespot-go-1 | /src/librespot/dealer/dealer.go:244 +0x66c
librespot-go-1 | created by github.com/devgianlu/go-librespot/dealer.(*Dealer).reconnect in goroutine 15025033
librespot-go-1 | /src/librespot/dealer/dealer.go:295 +0x158


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/devgianlu/go-librespot/pull/182 **Author:** [@skeller](https://github.com/skeller) **Created:** 4/23/2025 **Status:** ✅ Merged **Merged:** 4/23/2025 **Merged by:** [@devgianlu](https://github.com/devgianlu) **Base:** `master` ← **Head:** `fix_unlock` --- ### 📝 Commits (1) - [`cb077cc`](https://github.com/devgianlu/go-librespot/commit/cb077cc93593b7b2808ead1ccefec72948e5797f) bugfix: fix double unlock of mutex in dealer recvloop ### 📊 Changes **1 file changed** (+5 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `dealer/dealer.go` (+5 -4) </details> ### 📄 Description On error on backoff retry an error message is logged and the mutex unlocked. It is unlocked again outside the error handling and the loop is not stopped (if the unlock wouldn't panic). Fix this by correctly terminating the loop / cleaning up. Fixes this: librespot-go-1 | time="2025-04-21T05:15:11Z" level=error msg="failed reconnecting dealer" error="failed obtaining dealer access token: failed renewing login5 access token: failed authenticating with login5: UNKNOWN_ERROR" librespot-go-1 | fatal error: sync: Unlock of unlocked RWMutex librespot-go-1 | librespot-go-1 | goroutine 20295860 [running]: librespot-go-1 | sync.fatal({0xb0da65?, 0x2e28ae00000003?}) librespot-go-1 | /usr/lib/go/src/runtime/panic.go:1007 +0x20 librespot-go-1 | sync.(*RWMutex).Unlock(0x40002be858) librespot-go-1 | /usr/lib/go/src/sync/rwmutex.go:208 +0x74 librespot-go-1 | github.com/devgianlu/go-librespot/dealer.(*Dealer).recvLoop(0x40002be7e0) librespot-go-1 | /src/librespot/dealer/dealer.go:244 +0x66c librespot-go-1 | created by github.com/devgianlu/go-librespot/dealer.(*Dealer).reconnect in goroutine 15025033 librespot-go-1 | /src/librespot/dealer/dealer.go:295 +0x158 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-28 14:26:22 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-librespot#243
No description provided.