www/squid: configctl proxy stop returns before Squid exits, so stop+start (e.g. Monit restart) fails
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
調査の方向性
www/squid/src/opnsense/service/conf/actions.d/actions_proxy.confから始め、その停止アクションがSquidのrcスクリプトとkillallをどのように呼び出すかを追ってください。rcスクリプトの停止時の動作と、アクションが制限時間内にSquidの終了を待てる方法を確認してください。その後、停止直後にconfigctl proxy startを実行して成功することを検証してください。停止が終了を待つか、戻る前に制限時間付きの強制終了に至れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Important notices
Before you add a new report, we ask you kindly to acknowledge the following:
- I have read the contributing guide lines at https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md
- I have searched the existing issues, open and closed, and I'm convinced that mine is new.
- The title contains the plugin to which this issue belongs
Describe the bug
configctl proxy stop returns before Squid has exited. A start issued right after it (for example by a Monit service check that runs stop then start) launches a new Squid while the old one is still shutting down and holding its ports, so the new instance fails and the proxy stays down until something starts it again.
The [stop] action in www/squid/src/opnsense/service/conf/actions.d/actions_proxy.conf is:
/usr/local/etc/rc.d/squid stop;
/usr/bin/killall squid;
/usr/local/sbin/pluginctl -c webproxy stop;
exit 0
Squid's graceful shutdown waits up to shutdown_lifetime (30 s by default, not set in the generated squid.conf), and nothing in the action waits for the process to exit. In our case configctl proxy stop returned right away while Squid kept shutting down for roughly 30 seconds.
This matters most when the proxy is transparent: with port-forward rules pointing HTTP/HTTPS at Squid, every stop-then-start that loses this race means a client-facing web outage.
To Reproduce
- Enable the web proxy (transparent HTTP/HTTPS is where it hurts).
- Run
configctl proxy stop; configctl proxy start. pgrep squidright afterstopstill shows the old Squid for up to ~30 s; thestartfails (ports in use / pid still present) and the proxy is not running afterwards.- Same result with a Monit service for Squid using
configctl proxy stop/configctl proxy startand a connection test with "restart" as action.
Expected behavior
configctl proxy stop returns only after Squid has exited (or after a bounded wait, then a hard kill), so a following start is reliable.
Suggested fix
Wait for the Squid processes to exit before returning, for example after the existing killall:
i=0; while pgrep -qx squid && [ $i -lt 40 ]; do sleep 1; i=$((i+1)); done
pgrep -qx squid && /usr/bin/killall -9 squid
(or make the rc script's stop wait for the pid). Setting a shorter shutdown_lifetime alone would only narrow the window.
Additional context
We worked around it with a Monit stop script that runs configctl proxy stop, waits up to 50 s for the process to exit, then kills it. With that, restarts are reliable (~40 s round trip). configctl proxy restart is not a substitute in Monit because it fails when Squid is not running.
Environment
OPNsense 26.7.10 (amd64), os-squid 1.5_1, squid 7.7. The [stop] action on master is unchanged.
- 主要言語
- PHP
- スター
- 1.2k
- フォーク
- 932
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 22
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
opnsense/plugins のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
net/haproxy: IPv6 literal in real server "Source address" generates an invalid `source` directive対応中かも @fraenki が 6 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
opnsense/plugins#5973 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
[dns/ddclient] Support hiding unused standard fields per service (optional_hiding)対応中かも @bringha1 が 9 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
opnsense/plugins の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
Automattic/blocks-engine#7881 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
iruzen-dono/workless#117 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
magicsunday/webtrees-docker#285 ·
メンテナーはふだん 1 日以内に返信
-
area/tests type/bug when/soon
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
WP-CLI 3.0 fixes the cron lock and core download bugs described in the handbook対応中かも @mayankmajeji が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
WordPress/hosting-handbook#521 ·