Skip to content

Allow configuring timeouts via env - #55

Merged
thespad merged 2 commits into
mainfrom
timeout-config
Nov 15, 2026
Merged

thespad merged 2 commits into
mainfrom
timeout-config

Conversation

@thespad

@thespad thespad commented Oct 5, 2026

Copy link
Copy Markdown
Member

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

Description:

Closes #45

Benefits of this PR and context:

How Has This Been Tested?

Source / References:

@thespad
thespad requested a review from a team October 5, 2026 17:18
@thespad thespad self-assigned this Oct 5, 2026
@LinuxServer-CI

Copy link
Copy Markdown
Contributor

I am a bot, here are the test results for this PR for commit b022639 :
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.6-r0-pkg-d2610f98-dev-b022639c17dede99c439aca9b56a791b7e8c9d5f-pr-55/index.html
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.6-r0-pkg-d2610f98-dev-b022639c17dede99c439aca9b56a791b7e8c9d5f-pr-55/shellcheck-result.xml

Tag Passed
amd64-3.4.6-r0-pkg-d2610f98-dev-b022639c17dede99c439aca9b56a791b7e8c9d5f-pr-55 ✅
arm64v8-3.4.6-r0-pkg-d2610f98-dev-b022639c17dede99c439aca9b56a791b7e8c9d5f-pr-55 ✅

Comment thread root/docker-entrypoint.sh Resolved
@LinuxServer-CI

Copy link
Copy Markdown
Contributor

I am a bot, here are the test results for this PR for commit 9325223 :
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.7-r0-pkg-451c4db6-dev-9325223c24e8fb47d7399ec07ff0310d97a0e244-pr-55/index.html
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.7-r0-pkg-451c4db6-dev-9325223c24e8fb47d7399ec07ff0310d97a0e244-pr-55/shellcheck-result.xml

Tag Passed
amd64-3.4.7-r0-pkg-451c4db6-dev-9325223c24e8fb47d7399ec07ff0310d97a0e244-pr-55 ✅
arm64v8-3.4.7-r0-pkg-451c4db6-dev-9325223c24e8fb47d7399ec07ff0310d97a0e244-pr-55 ✅

@acouvreur

Copy link
Copy Markdown

Adding a data point for the /events case, and a suggestion for the defaults.

What I see on 3.4.7 (arm64). Sablier and Vector keep long-lived streams open through the proxy. Whenever a stream stays quiet for 10 minutes, HAProxy closes it with sD--, so timeout server is what fires:

proxy docker/socket 0/0/0/2/600055 200 197 - - sD-- 4/4/3/3/0 0/0 "GET /events?since=<t>&filters=<f> HTTP/1.1"
proxy docker/socket 0/0/0/2/600002 200 221 - - sD-- 4/4/3/3/0 0/0 "GET /containers/<id>/logs?follow=true&stdout=true&stderr=true&..."

It is an idle timeout: a Sablier /events stream that received some data stayed open for 26 minutes (1560122 ms). Clients see unexpected EOF, about 400 errors a day in Sablier's logs on my host. They reconnect, but Sablier can miss events while it does. Part of that is on Sablier's side (I maintain it and will fix the reconnect), but being quiet is normal for these endpoints, so they should not be cut in the first place.

Suggestion. TIMEOUT_CLIENT and TIMEOUT_SERVER are useful, but with a default of 10 every user of /events or logs -f still hits this until they find the variables. Raising them also applies to every request, including ordinary API calls where 10 minutes is a sensible limit. Could streaming endpoints get an adapted default out of the box?

I tested a dedicated backend, similar to the docker-events backend in Tecnativa/docker-socket-proxy:

backend docker-stream
    server socket $SOCKET_PATH
    timeout server 0

# in the frontend, before default_backend
use_backend docker-stream if { path,url_dec -m reg -i ^(/v[\d\.]+)?/events }
use_backend docker-stream if { path,url_dec -m reg -i ^(/v[\d\.]+)?(/libpod)?/containers/[a-zA-Z0-9_.-]+/logs } { query -m sub follow=true }

The test used two throwaway 3.4.7 containers and idle streams, with timeout client and timeout server lowered to 15s to make it quick:

Request Current config With the backend above
/events closed at 15 s, sD-- still open at 60 s, when my client stopped (CD--)
logs?follow=true closed at 15 s, sD-- still open at 60 s, when my client stopped (CD--)

timeout client stayed at 15s in the second column and did not close the streams. A plain GET /containers/<c>/json still went through the docker backend.

What this does not cover:

  • I only tested those two endpoints. stats, wait and /session (mentioned in [FEAT] Add possibility to change timeout from env variables or something #45) sound like the same class, but they are untested.
  • The rule above only matches follow=true. The Docker CLI sends follow=1, so a real rule needs both.
  • timeout server 0 logs missing timeouts for backend 'docker-stream' at startup. A long value would avoid that.
  • I did not test a client that disappears without closing its connection. With no server timeout, that connection could stay around for a long time.

The variables from this PR would still be useful on top of this, for example for long-running calls that are not on the streaming list.

@LinuxServer-CI

Copy link
Copy Markdown
Contributor

I am a bot, here are the test results for this PR for commit 1eae49a :
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.7-r0-pkg-f470ca66-dev-1eae49aa9c6ade6de092c670afbcce97c34c837b-pr-55/index.html
https://ci-tests.linuxserver.io/lspipepr/socket-proxy/3.4.7-r0-pkg-f470ca66-dev-1eae49aa9c6ade6de092c670afbcce97c34c837b-pr-55/shellcheck-result.xml

Tag Passed
amd64-3.4.7-r0-pkg-f470ca66-dev-1eae49aa9c6ade6de092c670afbcce97c34c837b-pr-55 ✅
arm64v8-3.4.7-r0-pkg-f470ca66-dev-1eae49aa9c6ade6de092c670afbcce97c34c837b-pr-55 ✅

@github-project-automation github-project-automation Bot moved this from PRs Ready For Team Review to PRs Approved in Issue & PR Tracker Nov 15, 2026
@thespad
thespad merged commit dbdf242 into main Nov 15, 2026
4 checks passed
@thespad
thespad deleted the timeout-config branch November 15, 2026 15:57
@LinuxServer-CI LinuxServer-CI moved this from PRs Approved to Done in Issue & PR Tracker Nov 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

[FEAT] Add possibility to change timeout from env variables or something

5 participants