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

Testing integration tests #3711

Closed
wants to merge 7 commits into from
Closed

Testing integration tests #3711

wants to merge 7 commits into from

Conversation

dimpar
Copy link
Contributor

@dimpar dimpar commented Sep 12, 2023

Testing PR, do not merge

It happens that keep-core client panics when interacting with the
go-electrum library. We noticed "concurrent write to websocket connection" error
was thrown when calling GetLatestBlockHeight() function. The stack trace
leads to gorilla/websocket/WriteMessage which is called from the
go-electrum client. The latest block height call was already wrapped
with a read mutex, but we should also wrap it with the write mutex as
well to prevent such concurrent errors.
In this test we spin up 20 goroutines that hit electrum's
client.SubscribeHeaders() concurrently. In the cab1168 commit we
introduced a RW lock on getting the latest block height function.
Without a W lock, the test would've failed with 'concurrent write to websocket connection' panic.
If there's no panic, then the W lock works. 20 goroutine was always
enough to see the panic thrown with only R lock.
@dimpar dimpar closed this Sep 12, 2023
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.

1 participant