goleak icon indicating copy to clipboard operation
goleak copied to clipboard

fix: Handle leading whitespace in elided frames marker

Open homme opened this issue 2 months ago • 1 comments

Fixes panic when parsing stack traces with indented elided frames marker.

Problem

Go's runtime can elide frames in very deep stack traces (e.g., AWS SDK v2 middleware with 33+ frames). The elision marker ...N frames elided... appears with leading whitespace (tabs/spaces), but the parser only checked for lines starting with ....

When the indented marker wasn't caught, it was passed to parseFuncName(), causing a panic: no function found: "...33 frames elided..."

Solution

Trim whitespace before checking for the elision marker pattern. This allows both indented and non-indented markers to be handled gracefully.

Example (Go 1.25.1)

        github.com/aws/aws-sdk-go-v2/service/sqs.(*disableHTTPSMiddleware).HandleFinalize(...)
        	/go/pkg/mod/github.com/aws/aws-sdk-go-v2/service/[email protected]/api_client.go:864 +0x143
        ...33 frames elided...
        github.com/aws/aws-sdk-go-v2/aws/middleware.ClientRequestID.HandleBuild(...)
        	/go/pkg/mod/github.com/aws/[email protected]/aws/middleware/middleware.go:42 +0x1e5

Note the leading whitespace before ...33 frames elided....

homme avatar Nov 05 '25 17:11 homme

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 05 '25 17:11 CLAassistant