-
Notifications
You must be signed in to change notification settings - Fork 160
Fix Squid proxy crash loop on container restart #3022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3022 +/- ##
=======================================
Coverage 56.82% 56.82%
=======================================
Files 335 335
Lines 33474 33474
=======================================
Hits 19022 19022
Misses 12868 12868
Partials 1584 1584 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Squid proxy containers enter an infinite crash loop when restarted via Docker directly because the PID file persists across restarts. Change pid_filename from /tmp/squid.pid to none so Squid doesn't create a PID file that can become stale on abrupt container restarts. The PID file was only used by Squid internally to prevent multiple instances. Since Docker ensures only one container runs, it's redundant. The container healthcheck uses ps aux | grep squid, not the PID file. Fixes stacklok#2440 Signed-off-by: carlos <21148423+carlos-gn@users.noreply.github.com>
5f23ebf to
377828a
Compare
Collaborator
|
@claude can you review this against squid security best practices? |
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
JAORMX
approved these changes
Dec 17, 2025
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.
Summary
Fixes #2440
When
-egressor-ingressproxy containers are restarted via Docker (e.g.,docker restart <workload>-egress), Squid enters an infinite crash loop because it finds a stale PID file from the previous instance.Root Cause
/tmp/squid.pidon startupdocker restart, Docker sends SIGTERM and Squid begins a 30-second graceful shutdownThis doesn't affect
thv restartbecause ToolHive uses a 30-second stop timeout giving Squid enough time to gracefully shutdown and clean up the PID file.Fix
Changed
pid_filename /tmp/squid.pidtopid_filename nonein the generated Squid config. Without a PID file, there's nothing to go stale.References
pid_filenamedocumentation - confirmsnoneis a valid value to disable PID file generationTest plan
thv run <server> --isolate-networkdocker restart <server>-egressdocker logs <server>-egressshows clean startup (no FATAL errors)task testto ensure no regressions