[PR #38] fix: relay buffer leak on UDP read error #37

Open
opened 2025-11-19 07:03:49 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/gerbil/pull/38
Author: @LaurenceJJones
Created: 11/16/2025
Status: 🔄 Open

Base: mainHead: fix/relay-buffer-leak


📝 Commits (1)

  • b2392fb relay: fix buffer leak on UDP read error by returning buffer to pool

📊 Changes

1 file changed (+2 additions, -0 deletions)

View changed files

📝 relay/relay.go (+2 -0)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

When ReadFromUDP fails in readPackets, the buffer was not returned to the sync.Pool, causing a small but persistent leak under error conditions. Return the buffer before continuing to ensure reuse and stable memory.

Scope: minimal hotfix (no broader refactors) based on my other branch that extensively updated relay.go

How to test?

Difficult but on error the buffer should be placed back into the pool instead of silently leaking as the sync.Pool cannot track its lifecycle as under error it believes the buffer is in use.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/gerbil/pull/38 **Author:** [@LaurenceJJones](https://github.com/LaurenceJJones) **Created:** 11/16/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/relay-buffer-leak` --- ### 📝 Commits (1) - [`b2392fb`](https://github.com/fosrl/gerbil/commit/b2392fb2503e1019ebc1c948d34007b23a84f322) relay: fix buffer leak on UDP read error by returning buffer to pool ### 📊 Changes **1 file changed** (+2 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `relay/relay.go` (+2 -0) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description When ReadFromUDP fails in readPackets, the buffer was not returned to the sync.Pool, causing a small but persistent leak under error conditions. Return the buffer before continuing to ensure reuse and stable memory. Scope: minimal hotfix (no broader refactors) based on my other branch that extensively updated relay.go ## How to test? Difficult but on error the buffer should be placed back into the pool instead of silently leaking as the sync.Pool cannot track its lifecycle as under error it believes the buffer is in use. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-19 07:03:49 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gerbil#37