Repository navigation
fix(dgw,jetsocat): stop leaking detached tasks - #2148
Merged
Benoît Cortier (CBenoit) merged 1 commit intoOct 23, 2026
Merged
Benoît Cortier (CBenoit) merged 1 commit into
Benoît Cortier (CBenoit) merged 1 commit into
Conversation
`ChildTask::detach` skipped the abort in `Drop` by calling `mem::forget` on the task's `JoinHandle`. A forgotten handle never gives back its reference to the task, so tokio never frees a detached task once it finishes, and keeps its output too. The HTTP, HTTPS and TCP listeners detach one task per accepted connection, so every connection leaks a few KB for the lifetime of the process. Kubernetes HTTP probes open a new connection each time, so an otherwise idle Gateway grows by about 16 MiB a day until it reaches its memory limit. `detach` now marks the task as detached and drops the handle normally, which detaches the task without aborting it. The private copy of `ChildTask` in `jmux-proxy`, used by Gateway and Jetsocat, gets the same fix. Fixes Devolutions#1973 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Lines changed (against
Validation (Linux arm64 container,
On
|
Benoît Cortier (CBenoit)
approved these changes
Oct 23, 2026
Member
|
Thank you very much for this contribution, I appreciate it. Your PR is minimal and straightforward. Thanks again! |
Benoît Cortier (CBenoit)
enabled auto-merge (squash)
October 23, 2026 16:10
Benoît Cortier (CBenoit)
merged commit Oct 23, 2026
e6587f2
into
Devolutions:master
51 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ChildTask::detachskipped the abort inDropby callingmem::forgeton the task'sJoinHandle. A forgotten handle never gives back its reference to the task, so tokio never frees a detached task once it finishes, and keeps its output too. The HTTP, HTTPS and TCP listeners detach one task per accepted connection, so every connection leaks a few KB for the lifetime of the process. Kubernetes HTTP probes open a new connection each time, so an otherwise idle Gateway grows by about 16 MiB a day until it reaches its memory limit.detachnow marks the task as detached and drops the handle normally, which detaches the task without aborting it. The private copy ofChildTaskinjmux-proxy, used by Gateway and Jetsocat, gets the same fix.Fixes #1973
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com