Skip to content

fix(rpc): Race condition when waiting for response on broadcast_tx_sync/commit (backport #3193)#3194

Merged
hvanz merged 2 commits intov1.xfrom
mergify/bp/v1.x/pr-3193
Jun 5, 2024
Merged

fix(rpc): Race condition when waiting for response on broadcast_tx_sync/commit (backport #3193)#3194
hvanz merged 2 commits intov1.xfrom
mergify/bp/v1.x/pr-3193

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Jun 5, 2024

This PR fixes a race condition generated when calling broadcast_tx_sync and broadcast_tx_commit. When closing the context, we want to also close the goroutine waiting for the response with reqRes.Wait(). We don't need to do reqRes.Done() because there is a chance it may become negative; instead, we just let the ABCI client to do it.

This bug was recently introduced by #3131.


PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments
  • Title follows the Conventional Commits spec

This is an automatic backport of pull request #3193 done by [Mergify](https://mergify.com).

…ync/commit` (#3193)

This PR fixes a race condition generated when calling
`broadcast_tx_sync` and `broadcast_tx_commit`. When closing the context,
we want to also close the goroutine waiting for the response with
`reqRes.Wait()`. We don't need to do `reqRes.Done()` because there is a
chance it may become negative; instead, we just let the ABCI client to
do it.

This bug was recently introduced by #3131.

---

#### PR checklist

- [ ] Tests written/updated
- [ ] Changelog entry added in `.changelog` (we use
[unclog](https://github.com/informalsystems/unclog) to manage our
changelog)
- [ ] Updated relevant documentation (`docs/` or `spec/`) and code
comments
- [ ] Title follows the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec

(cherry picked from commit cd465c5)

# Conflicts:
#	rpc/core/mempool.go
@mergify mergify bot requested a review from a team as a code owner June 5, 2024 13:59
@mergify mergify bot requested a review from a team June 5, 2024 13:59
@mergify mergify bot added the conflicts label Jun 5, 2024
@mergify

This comment was marked as resolved.

@hvanz hvanz removed the conflicts label Jun 5, 2024
@hvanz hvanz merged commit ed72e21 into v1.x Jun 5, 2024
@hvanz hvanz deleted the mergify/bp/v1.x/pr-3193 branch June 5, 2024 14:09
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