Initial UnknownHostException is Unrecoverable
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 停滞
- 技術スタック
- java
- 領域
- networking
調査の方向性
RawSocketSender のコンストラクターとその connect() メソッドから始め、特にサーバーアドレスがどのように保存され、再利用されるかを確認してください。初回のホスト名解決に失敗した場合と、フェイルオーバー中に DNS が変更された場合の動作を検証してください。再接続で古い解決済みアドレスではなく、現在のホスト名解決が使用されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The RawSocketSender takes a host and port in its constructor and coverts these into an InetSocketAddress, which tries to resolve the hostname. On RawSocketSender connect this InetSocketAddress is used to reconnect, but if it wasn't resolved during fluent-logger init then it will fail over and over. The code snipped from RawSocketSender is below:
public RawSocketSender(String host, int port, int timeout, int bufferCapacity, Reconnector reconnector) {
msgpack = new MessagePack();
msgpack.register(Event.class, Event.EventTemplate.INSTANCE);
pendings = ByteBuffer.allocate(bufferCapacity);
server = new InetSocketAddress(host, port); // Create InetSocketAddress on init
this.reconnector = reconnector;
name = String.format("%s_%d_%d_%d", host, port, timeout, bufferCapacity);
this.timeout = timeout;
}
private void connect() throws IOException {
try {
socket = new Socket();
socket.connect(server, timeout); // Reconnection uses pre-resolved server field
out = new BufferedOutputStream(socket.getOutputStream());
} catch (IOException e) {
throw e;
}
}
This issue comes up when using the fluent-logger in a highly dynamic environment (like on Docker Swarm) where apps may come up before a DNS entry in Consul is even resolvable. It also means that during failover of a Fluent host (triggering a DNS change) the then failing socket connection will always try the old Fluent host IP and never re-resolve the DNS entry.
My recommendation is to store the Fluent host and port as private fields within the RawSocketSender, not a resolved InetSocketAddress (now stored as this.server) and create a new InetSocketAddress on every socket connection.
I understand there will be performance implications of this and am happy to submit a PR, but wanted to bring it up in an issue in case there were reasons for implementing the RawSocketSender the current way.
- 主要言語
- Java
- スター
- 210
- フォーク
- 86
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fluent/fluent-logger-java のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
fluent/fluent-logger-java#100 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
fluent/fluent-logger-java#99 · コメント 1 件 · リアクション 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
fluent/fluent-logger-java#98 · コメント 1 件 ·
-
Null Pointer Exception with slf4j-log4j12-1.7.30 (Fluent-logger incompatible with the new version) オープン
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
fluent/fluent-logger-java#89 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
fluent/fluent-logger-java#88 · コメント 1 件 ·
fluent/fluent-logger-java の issue をすべて見る
似ている issue
-
certification
難易度 1/5 1時間未満 初心者へのやさしさ 80/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's オープンbug ecr
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
Needs: Triage Type: Feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
github/copilot-sdk#2760 ·