Skip to content

Commit

Permalink
avoid generating large output on TestDeadlockLogging. (#3771)
Browse files Browse the repository at this point in the history
## Summary

The TestDeadlockLogging was generating large amount of "junk" on top of the expected stack trace.
This PR addresses that by dropping the redundant data.

Example: https://circleci.com/api/v1.1/project/github/algorand/go-algorand/92568/output/106/0?file=true&allocation-id=622fb105959ff4390b6b098f-0-build%2F5VSI2HBA
## Test Plan

Unit test exists.
  • Loading branch information
tsachiherman authored Mar 15, 2022
1 parent 08792f2 commit 5786a4e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion daemon/algod/deadlockLogger.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ func captureCallstack() []byte {
bufferSize := 256 * 1024
for {
buf = make([]byte, bufferSize)
if runtime.Stack(buf, true) < bufferSize {
if writtenBytes := runtime.Stack(buf, true); writtenBytes < bufferSize {
buf = buf[:writtenBytes]
break
}
bufferSize *= 2
Expand Down

0 comments on commit 5786a4e

Please sign in to comment.