Skip to content

fix(test): TestBlockPoolMaliciousNode shutdown threads at exit (backport #4633)#4634

Merged
melekes merged 1 commit intov1.xfrom
mergify/bp/v1.x/pr-4633
Dec 9, 2024
Merged

fix(test): TestBlockPoolMaliciousNode shutdown threads at exit (backport #4633)#4634
melekes merged 1 commit intov1.xfrom
mergify/bp/v1.x/pr-4633

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Dec 9, 2024

This is a drive-by fix of a test that doesn't shut its threads down until the whole go test execution finishes. I think we have a bunch of these, but I came across this one during an unrelated troubleshooting.

Is it worth fixing this? It's not really causing any issues, it's just sloppy coding.

The only way to see any difference is to run the go test until it reaches its time limit and panics. In that case, the trace will contain references to the threads.

For example:

go test github.com/cometbft/cometbft/blocksync -v -run TestBlockPoolMaliciousNode -count 100 -failfast -race -timeout 30s

After 30 seconds the test didn't run 100 times yet, hence go test panics. Because the test has been run multiple times already, multiple sets of threads will be reported in the panic. With the fix, only one set is reported.

Author: @greg-szabo


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

This is a drive-by fix of a test that doesn't shut its threads down
until the whole `go test` execution finishes. I think we have a bunch of
these, but I came across this one during an unrelated troubleshooting.

Is it worth fixing this? It's not really causing any issues, it's just
sloppy coding.

The only way to see any difference is to run the `go test` until it
reaches its time limit and panics. In that case, the trace will contain
references to the threads.

For example:
```
go test github.com/cometbft/cometbft/blocksync -v -run TestBlockPoolMaliciousNode -count 100 -failfast -race -timeout 30s
```

After 30 seconds the test didn't run 100 times yet, hence `go test`
panics. Because the test has been run multiple times already, multiple
sets of threads will be reported in the panic. With the fix, only one
set is reported.

Author: @greg-szabo

---------

Co-authored-by: Greg Szabo <greg@philosobear.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
(cherry picked from commit fdaca92)
@mergify mergify bot assigned melekes Dec 9, 2024
@mergify mergify bot requested a review from a team as a code owner December 9, 2024 09:56
@mergify mergify bot requested a review from a team December 9, 2024 09:56
@melekes melekes merged commit 586be7e into v1.x Dec 9, 2024
@melekes melekes deleted the mergify/bp/v1.x/pr-4633 branch December 9, 2024 11:38
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