Skip to content

fix(tcpreuse): handle connection that failed to be sampled - #3036

Merged
MarcoPolo merged 4 commits into
masterfrom
fix/tcpreuse
Nov 21, 2024
Merged

MarcoPolo merged 4 commits into
masterfrom
fix/tcpreuse

Conversation

@aschmahmann

Copy link
Copy Markdown
Collaborator

There was an oversight here in the error reporting. A test should be added, but also probably this should've been caught by automated tooling (e.g. one of the linters), maybe there are more we should be enabling.

@aschmahmann
aschmahmann marked this pull request as draft November 12, 2024 05:04
return 0, nil, errors.Join(err, closeErr)
}

s, c, err := sampledconn.PeekBytes(c)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes aren't necessary, right? It's also not a peekableConn. It's just a manet.Conn. If you want to rename, i would rename the parameter.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. This shadows the c in L53.

@MarcoPolo

Copy link
Copy Markdown
Collaborator

The issue was that the returned connection may be nil when an error is returned, right?

@MarcoPolo

Copy link
Copy Markdown
Collaborator

https://github.com/uber-go/nilaway Seems promising, but not sure if it would have caught this issue.

@MarcoPolo
MarcoPolo marked this pull request as ready for review November 12, 2024 23:22
@MarcoPolo
MarcoPolo merged commit 773bedf into master Nov 21, 2024
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.

2 participants