Skip to content

Add option to detect deadlocks in Core.stateLock using build tag deadlock#8524

Merged
ncabatoff merged 4 commits into
masterfrom
deadlock-detection-via-build-tag
Mar 10, 2020
Merged

Add option to detect deadlocks in Core.stateLock using build tag deadlock#8524
ncabatoff merged 4 commits into
masterfrom
deadlock-detection-via-build-tag

Conversation

@ncabatoff
Copy link
Copy Markdown
Collaborator

No description provided.

@ncabatoff ncabatoff requested a review from briankassouf March 10, 2020 18:45
briankassouf
briankassouf previously approved these changes Mar 10, 2020
Comment thread vault/expiration.go Outdated
quitCh chan struct{}

coreStateLock *sync.RWMutex
coreStateLock *DeadlockMutexRW
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a comment here about the buildtag-conditional behavior, as well as what one should expect if the deadlock detection is enabled?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, but I think I'd rather put the comment next to the type definition(s), since we may wind up using this in other places than just stateLock. Would that be acceptable?

Comment thread vault/deadlock.go Outdated
"github.com/sasha-s/go-deadlock"
)

// DeadlockMutexW, when the build tag `deadlock` is present, behaves like a
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit, why not call it DeadlockMutex (and DeadlockRWMutex)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember what my rationale was, so I'll change it to be the more natural way as you suggest.

@ncabatoff ncabatoff merged commit 1101538 into master Mar 10, 2020
@ncabatoff ncabatoff deleted the deadlock-detection-via-build-tag branch March 10, 2020 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants