Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): protect against UDP panic #2371

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

fortuna
Copy link
Collaborator

@fortuna fortuna commented Feb 7, 2025

No description provided.

@fortuna fortuna requested review from sbruens and jyyi1 February 7, 2025 23:19
@fortuna fortuna requested a review from a team as a code owner February 7, 2025 23:19
Copy link
Contributor

@jyyi1 jyyi1 left a comment

Choose a reason for hiding this comment

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

Sounds like a workaround, maybe have a todo comment mentioning the ideal fix?

func (h *udpHandler) ReceiveTo(tunConn core.UDPConn, data []byte, destAddr *net.UDPAddr) (err error) {
defer func() {
if r := recover(); r != nil {
slog.Error("Panic in UDP handler", "err", r)
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this log be collected by Sentry?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it might.

@fortuna
Copy link
Collaborator Author

fortuna commented Feb 7, 2025

Humm... I'm not 100% convinced about this PR. If we recover from panic, the proxyConn may be in a corrupted state, so future Writes will likely panic as well. Possibly the reads and close too.

We could try to discard them, but Close is needed for cleanup.

Needs more thought.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants