mirror of
https://github.com/fosrl/newt.git
synced 2026-07-11 04:23:20 -05:00
[PR #304] fix: chunk large Docker container lists to prevent WebSocket message loss #6308
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?
📋 Pull Request Information
Original PR: https://github.com/fosrl/newt/pull/304
Author: @jaydeep-pipaliya
Created: 4/9/2026
Status: 🔄 Open
Base:
main← Head:fix/chunk-docker-container-messages📝 Commits (10+)
458912eMerge pull request #174 from fosrl/dependabot/github_actions/docker/metadata-action-5.9.07148574Merge pull request #175 from fosrl/dependabot/github_actions/docker/setup-qemu-action-3.7.078dc39eMerge pull request #181 from fosrl/dependabot/github_actions/github/codeql-action-4.31.537c96d0Merge pull request #182 from fosrl/dependabot/github_actions/actions/setup-go-6.1.0f417ee3Merge pull request #186 from fosrl/dependabot/docker/minor-updates-60be0b6e22e5e7331Merge branch 'main' into dev5ce3f45Fix adding new exit nodes to hp not sending interval87e2eb3Update readme3bcafbfHandle server version and prevent backward issues with clients6948066Merge pull request #192 from fosrl/dev📊 Changes
102 files changed (+21682 additions, -1115 deletions)
View changed files
➕
.env.example(+5 -0)➕
.github/DISCUSSION_TEMPLATE/feature-requests.yml(+47 -0)➕
.github/ISSUE_TEMPLATE/1.bug_report.yml(+51 -0)➕
.github/ISSUE_TEMPLATE/config.yml(+8 -0)📝
.github/dependabot.yml(+5 -0)📝
.github/workflows/cicd.yml(+932 -57)➕
.github/workflows/mirror.yaml(+132 -0)➕
.github/workflows/nix-build.yml(+23 -0)➕
.github/workflows/nix-dependabot-update-hash.yml(+48 -0)➕
.github/workflows/stale-bot.yml(+37 -0)📝
.github/workflows/test.yml(+24 -13)📝
.gitignore(+6 -2)📝
.go-version(+1 -1)📝
CONTRIBUTING.md(+2 -6)📝
Dockerfile(+13 -5)📝
Makefile(+64 -28)📝
README.md(+7 -157)📝
SECURITY.md(+1 -1)➕
authdaemon.go(+150 -0)➕
authdaemon/connection.go(+27 -0)...and 80 more files
📄 Description
What does this PR do?
Companion PR for fosrl/pangolin#2117 — Docker Container View not displaying when >20 containers are running.
Problem
gorilla/websocket.WriteJSONserializes the full container list into a single WebSocket text frame. With 55+ containers (each 1-5KB of JSON metadata), the resulting frame can be 55-275KB. Intermediary proxies (Traefik, nginx, Cloudflare tunnels) can silently drop or truncate frames this large, causing the pangolin server to never receive the container data.Solution
Added
sendContainerList()that automatically chunks large container lists:Why
batchId?Two concurrent container sends can happen when a manual fetch request and a Docker event fire at the same time. Without
batchId, their chunks would interleave and corrupt the accumulated data on the server. Each batch gets a unique ID (reusing the existinggenerateChainIdhelper) so the server can track and supersede batches correctly.Why chunk size of 15?
Each container with full metadata (labels, ports, networks) serializes to 1-5KB. 15 containers ≈ 15-75KB per WebSocket frame — safely under common proxy defaults (Traefik default buffer: 64KB, nginx: 64KB). The threshold was chosen to balance message count vs. frame size.
Changes
main.go:sendContainerList()— chunks large lists, passes small lists through unchangedgenerateChainId()for batch IDs — no new dependenciesCompanion PR
Pangolin server: https://github.com/fosrl/pangolin/pull/2817
batchIdtracking, input validation, typed accumulator, 120s TTL on partial chunksTesting
go buildpasseschunkIndex/totalChunks/batchIdbatchId, server handles superseding🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.