mirror of
https://github.com/fosrl/newt.git
synced 2026-05-05 23:50:10 -05:00
[GH-ISSUE #220] TCP socket leak when healthcheck enabled with 204 response code #248
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mprokopiev on GitHub (Dec 24, 2025).
Original GitHub issue: https://github.com/fosrl/newt/issues/220
Originally assigned to: @oschwartz10612 on GitHub.
Describe the Bug
I've been using a latest newt (problem also happened in 1.7.0 - upgraded for this issue purpose) and observed that among all resources with healthchecks configured, newt has a tcp socket leak for a single resource, which responds with 204 (which is configured as successful response code). This problem eventually caused the error when connecting to the resource either for healthchecks or any other valid communication:
Before newt restart, I found newt has 23k of opened sockets with above address - resource address in docker container.
I've made a simple script:
And called it every 10 min:
All of the opened sockets are related to a single resource:
All of the opened sockets has ESTABLISHED state:
The config is quite generic:

I run curl for that IP and there is no unusual headers which may cause newt to keep the connection opened:
Disabling healthcheck for that resource stops this problem - no sockets are being added up.
I think it should be easy to reproduce, however I saved newt debug journal and can attach if needed.
Environment
To Reproduce
I believe it has to do to 204 HTTP code cause the rest of resources are working fine. Assuming so, configuring any resource to respond to healthcheck with 204 should do the trick. I am using Pocket ID which responds with 204 to the healthcheck.
Expected Behavior
Connection close.
@oschwartz10612 commented on GitHub (Dec 24, 2025):
This will be fixed in the next patch release by
a701add824