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

dcr: Remove tx history wait. #3005

Merged
merged 1 commit into from
Oct 11, 2024
Merged

Conversation

JoeGruffins
Copy link
Member

closes #2971

handleTipChange must wait until the go functions are finished, so the tipMtx is held for writes for both of them. syncTxHistory calls SyncStatus which also conditionally holds the tipMtx for reads, randomly causing deadlock. I think running syncTxHistory as a goroutine and not waiting is the simplest answer.

@JoeGruffins
Copy link
Member Author

Example showing this behavior https://go.dev/play/p/F6KWiFSUfZb

@JoeGruffins
Copy link
Member Author

Possibly also fixes #3000, #2857, #2917

Copy link
Contributor

@martonp martonp left a comment

Choose a reason for hiding this comment

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

Nice.

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
dcr.syncTxHistory(ctx, uint64(newTipHeight))
}()
go dcr.syncTxHistory(ctx, uint64(newTipHeight))
Copy link
Member

Choose a reason for hiding this comment

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

How about using the ExchangeWallet.wg here instead so at least we don't have an unmonitored goroutine?

Copy link
Member Author

Choose a reason for hiding this comment

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

SyncStatus has a chance to hold the tipMtx so run it in a goroutine and
do not wait.
@buck54321 buck54321 merged commit 92ec499 into decred:master Oct 11, 2024
5 checks passed
buck54321 pushed a commit to buck54321/dcrdex that referenced this pull request Oct 17, 2024
SyncStatus has a chance to hold the tipMtx so run it in a goroutine and
do not wait.
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.

simnet/dcr: tip report channel was blocking
3 participants