Possible UDP startup readiness race causing an intermittent initialization hang
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- cpp
- 領域
- backend, networking
調査の方向性
Start with the UDP startup block in src/traffic_server/traffic_server.cc and trace _afterStartCallback assignment through thread_started() and the et_udp_threads_ready wait. Check whether a worker can report readiness before the callback is registered, and whether that notification is replayed. The issue reports that the isolated harness demonstrated the interleaving, while targeted ATS runs did not reproduce the hang; review the ordering and suggest a reliable reproducer or diagnostics.
索引モデルが issue の本文から書いたものです。
説明
Summary
We observed one instance of ATS failing to complete initialization during an HTTP/3 Uranium test on Rocky Linux 10.
While investigating, we noticed that the UDP thread-group readiness callback is registered after starting the worker threads. We suspect a fast-starting worker can complete initialization before the callback is installed, leaving the main thread waiting indefinitely for UDP readiness.
We have not confirmed that this race caused the observed timeout. Subsequent targeted runs passed with both the original and modified ordering. We would appreciate someone taking a closer look to confirm whether our analysis and proposed fix are correct.
Environment
- ATS 10.2.2
- Rocky Linux 10
- QUIC enabled using the OpenSSL native backend
- Four network threads
- One UDP thread
Relevant test configuration:
records:
exec_thread:
autoconfig:
enabled: 0
limit: 4
udp:
threads: 1
quic:
server:
stateless_retry_enabled: 1
Observed failure
The following Uranium test timed out during ATS startup:
test_h3_stateless_retry_with_listener_threads[1]
Reported error:
tools.uranium.process.ProcessError:
Timed out after 60s waiting for ts-h3-listener-threads-retry-1:
the fully initialized log message.
ATS remained alive throughout the startup wait. The full suite reported:
1 failed, 1259 passed, 66 skipped in 3395.55s (0:56:35)
Captured diagnostic log excerpt
[Nov 18 13:25:59.485] traffic_server NOTE: remap.config loading ...
[Nov 18 13:25:59.486] traffic_server NOTE: strategies.yaml loading ...
[Nov 18 13:25:59.486] traffic_server NOTE: strategies.yaml finished loading
[Nov 18 13:25:59.486] traffic_server NOTE: remap.config finished loading
[Nov 18 13:25:59.486] [ET_NET 2] NOTE: hosting.config loading ...
[Nov 18 13:25:59.487] [ET_NET 2] NOTE: cache enabled
This excerpt omits intervening path-specific diagnostic entries. No fully initialized message appeared before the timeout.
We did not capture thread backtraces, so the failed process's precise blocking location is unknown.
Suspected mechanism
In src/traffic_server/traffic_server.cc, the startup ordering is:
udpNet.register_event_type();
if (num_of_udp_threads) {
udpNet.start(num_of_udp_threads, stacksize);
eventProcessor.thread_group[ET_UDP]._afterStartCallback = init_HttpProxyServer;
}
Our understanding is that the following interleaving is possible:
- Main starts UDP threads through
udpNet.start(). - The last UDP worker completes initialization before the callback is assigned.
thread_started()observes a null_afterStartCallbackand does not invoke it.- Main assigns the callback, but the readiness notification is not replayed.
- With QUIC enabled, main waits for
et_udp_threads_ready, which remains false.
This appears capable of preventing listener startup. However, without a backtrace from the original failure, we cannot establish that this was the path taken.
Proposed fix
Register the readiness callback before starting the UDP workers:
udpNet.register_event_type();
if (num_of_udp_threads) {
- udpNet.start(num_of_udp_threads, stacksize);
eventProcessor.thread_group[ET_UDP]._afterStartCallback = init_HttpProxyServer;
+ udpNet.start(num_of_udp_threads, stacksize);
}
This should make the callback available before any UDP worker can complete initialization and follows the existing ET_NET callback-registration approach.
Investigation and validation
Deterministic scheduling check
A standalone C++ scheduling harness using the source callback bodies and startup block arranged for the worker to finish before start() returned.
| Ordering | Result |
|---|---|
| Original ordering | UDP readiness notification lost |
| Proposed ordering | UDP readiness notification delivered |
This demonstrates the suspected interleaving in an isolated harness, not a full ATS reproduction.
Full suite with the proposed fix
The full Rocky Linux 10 / ATS 10.2.2 Uranium suite passed with QUIC enabled:
================ 1262 passed, 64 skipped in 3435.16s (0:57:15) =================
Compilation, installation checks, tarball generation, and RPM packaging also succeeded.
Like-for-like targeted comparison
We subsequently ran both stateless-retry test variants using identical workflow configuration and retained their sandbox startup logs.
The ATS source revisions differed only by the callback-registration ordering.
| Build | Result |
|---|---|
| Proposed fix | Both test cases passed |
| Original, unfixed baseline | Both test cases passed |
The targeted comparison did not reproduce the hang. We have observed the initialization failure only once, and do not currently have a reliable full-ATS reproducer.
Fixed build: captured successful startup excerpt
[Nov 18 16:55:04.605] traffic_server NOTE: remap.config loading ...
[Nov 18 16:55:04.605] traffic_server NOTE: strategies.yaml loading ...
[Nov 18 16:55:04.605] traffic_server NOTE: strategies.yaml finished loading
[Nov 18 16:55:04.606] traffic_server NOTE: remap.config finished loading
[Nov 18 16:55:04.608] [TS_MAIN] NOTE: traffic server running
[Nov 18 16:55:04.608] [ET_NET 2] NOTE: hosting.config loading ...
[Nov 18 16:55:04.609] [ET_NET 2] NOTE: cache enabled
[Nov 18 16:55:04.609] [ET_NET 2] NOTE: Traffic Server is fully initialized.
Unfixed baseline: captured successful startup excerpt
[Nov 18 16:58:40.329] [ET_NET 2] NOTE: cache enabled
[Nov 18 16:58:40.329] [ET_NET 2] NOTE: Traffic Server is fully initialized.
Potential impact
If the analysis is correct, the hang requires QUIC transport support and nonzero UDP threads, with HTTP processing enabled.
Although encountered in an HTTP/3 test, the readiness wait occurs before listener startup, so it could also prevent HTTP/1.1 and HTTP/2 listeners from becoming available.
Request for review
Could someone familiar with the event-system and UDP startup sequence review this ordering and confirm:
- Whether a UDP worker can finish initialization before
_afterStartCallbackis registered. - Whether that would leave the main thread waiting indefinitely for UDP readiness.
- Whether moving callback registration before
udpNet.start()is the appropriate fix.
We would also welcome suggestions for a reliable reproducer or additional diagnostics. If the timeout recurs, we plan to capture all thread backtraces before terminating ATS.
- 主要言語
- C++
- スター
- 2k
- フォーク
- 903
- 平均マージ
- 4日 4時間
- マージ済み PR(30日)
- 135
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/trafficserver のほかの issue
-
UnixNetVConnection::do_io_write with a null reader leaves the previous reader in the write VIO対応中かも @NginxL が今日担当しました。 オープンBug Good First Issue IOBuffer Network
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14220 ·
メンテナーはふだん 2 日以内に返信
-
MallocAllocator does not check for allocation failure対応中かも @umrndem が今日担当しました。 オープンBug Core Good First Issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14218 · コメント 2 件 ·
メンテナーはふだん 2 日以内に返信
-
Bug Event System Threads
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/trafficserver#14217 ·
メンテナーはふだん 2 日以内に返信
-
TSContScheduleEveryOnPool and TSContScheduleEveryOnThread accept a zero or negative period対応中かも @rajeetvk が 1 日前に担当しました。 オープンBug Event System Good First Issue TS API
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14214 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
HostDBContinuation::init memsets a polymorphic Action対応中かも @ANMOLSCRIPT が今日担当しました。 オープンBug Good First Issue HostDB
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/trafficserver#14204 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
apache/trafficserver の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 2 日以内に返信
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
ClickHouse/clickhouse-cpp#645 ·
メンテナーはふだん 1 日以内に返信
-
bug compatibility difficulty:easy prio:normal
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
NatronGitHub/openfx-misc#524 ·
メンテナーはふだん 1 日以内に返信
-
documentation enhancement help wanted P0
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
メンテナーはふだん 1 日以内に返信
-
Type: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openscad/openscad#7360 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信