excessive logging: "Session N logged out. Waiting for processes to exit."
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 70/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c
調査の方向性
session_stop_scope() から始めて、そのログ出力を session_finalize() と比較してください。レポートでは、else 分岐がログを出すのはプロセスが実際にスコープ内に残っている場合だけにし、info ではなく debug レベルで出すことが求められています。ssh host true のループで再現し、その間 journalctl -u systemd-logind -f を監視してから、通常のセッション終了では既存の info レベルの "New session" と "Removed session" 行だけが表示されることを確認してください。完了条件は、通常のセッション終了時に info レベルの "Waiting for processes to exit" が出ず、スコープにまだプロセスがある場合にのみ debug メッセージが出ることです。
索引モデルが issue の本文から書いたものです。
説明
systemd version the issue has been seen with
systemd 259 (259.9-0ubuntu0.1)
Used distribution
Ubuntu 26.04
Component
systemd-logind
Expected behaviour you didn't see
With KillUserProcesses=no (the default), session_stop_scope() logs
Session c87010 logged out. Waiting for processes to exit.
at info level on every normal session end. The end of the session is already
recorded at info level by session_finalize():
Removed session c87010.
On a normal session end the first message has no meaning and carries no
information: nothing is waited for, and "Removed session" follows within about
a millisecond. The message is also worded wrongly in that case: it is logged in
the else branch of session_stop_scope() whenever processes are not killed,
without checking whether the scope still has any processes, so it says
"Waiting for processes to exit" when no process is being waited for. A message
like this should be logged only when there is
something to report, for example when processes really remain in the scope
after the session has ended. Even then it is only useful for debugging, so it
belongs at debug level, not info. A session that does not finish is already
visible without this message: loginctl list-sessions and loginctl show-session <ID> show it as State=closing. "New session" and "Removed
session" remain the info-level record of a session, when it started and when it
finished.
Unexpected behaviour you saw
Every short SSH session produces both lines back to back. Example, from
/var/log/auth.log (one ssh login session):
2026-11-15T12:35:45.337414+03:00 host systemd-logind[255]: Session c87010 logged out. Waiting for processes to exit.
2026-11-15T12:35:45.338469+03:00 host systemd-logind[255]: Removed session c87010.
The gap between the two lines was 1.06 ms for this session, and 0.42 ms and
0.97 ms for two other sessions I looked at.
Each session logs 3 systemd-logind lines (New session, logged out, Removed
session), and the "logged out" line carries no information that "Removed
session" does not already carry. On a host with many short sessions (about
105,000 per week here) this is a lot of log volume.
Steps to reproduce the problem
- Default logind.conf (KillUserProcesses=no).
- Run
ssh host truein a loop. - Watch
journalctl -u systemd-logind -f: each session prints both lines
within about a millisecond.
Additional program output to the terminal or log subsystem illustrating the issue
See the two lines above. Both are PRIORITY=6 in the journal, so
LogLevelMax= on the unit cannot drop one without dropping the other.
Possible approach
Do not log "logged out. Waiting for processes to exit." on a normal session
end. If it is kept for the case where processes remain in the scope, log it
only then, and at LOG_DEBUG instead of LOG_INFO.
Related: #26744 and #43745 are about sessions that stay in State=closing
indefinitely; this report is about the opposite, ordinary case where the
session is removed at once.
- 主要言語
- C
- スター
- 17k
- フォーク
- 4.8k
- 平均マージ
- 2日 10時間
- マージ済み PR(30日)
- 342
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
systemd/systemd のほかの issue
-
hwdb needs-patch
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
systemd/systemd#44825 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
cryptsetup
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
documentation pid1
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
needs-better-log-message network RFE 🎁
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
systemd/systemd#44563 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
RFE 🎁
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
systemd/systemd の issue をすべて見る
似ている issue
-
polish
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
ChupathingyCE/chupathingyce#1366 ·
メンテナーはふだん 1 日以内に返信
-
slice track:dev
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
Life-Framework/Life-Framework#1831 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
-
bug intrinsic low priority wrong result
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信