最新的2.0.8版本在linux中会出现Name or service not known错误
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 64/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- csharp
- Domain
- networking
Research direction
Start at Apache.IoTDB.SessionPool.CreateAndOpen and inspect which TSocketTransport constructor it uses, then compare the overloads described in the issue. Reproduce the connection with an IP address on Linux and verify that the session pool opens without requiring an /etc/hosts hostname, while preserving hostname connections.
Written by the indexing model from the issue text.
Description
升级2.0.8版本后linux系统上的连接出现问题,报错:Error occurs when opening session pool. Client pool size is not equal to the expected size. Client pool size: 0, expected size: 1, Please check the server status
但是windows上的连接没有问题。
通过日志发现如下错误:
warn: IoTDB[0]
Failed to create connection 1/1 to 192.168.1.10:6667
Thrift.Transport.TTransportException: Name or service not known
---> System.Net.Sockets.SocketException (00000005, 0xFFFDFFFF): Name or service not known
at System.Net.Dns.GetHostEntryOrAddressesCore(IPAddress address, Boolean justAddresses, AddressFamily addressFamily, Nullab>
at System.Net.Dns.GetHostEntry(String hostNameOrAddress, AddressFamily family)
at Thrift.Transport.Client.TSocketTransport..ctor(String host, Int32 port, TConfiguration config, Int32 timeout)
--- End of inner exception stack trace ---
at Thrift.Transport.Client.TSocketTransport..ctor(String host, Int32 port, TConfiguration config, Int32 timeout)
at Apache.IoTDB.SessionPool.CreateAndOpen(String host, Int32 port, Boolean enableRpcCompression, Int32 timeout, Boolean use>
at Apache.IoTDB.SessionPool.Open(CancellationToken cancellationToken)
检查发现Apache.IoTDB.SessionPool.CreateAndOpen调用了public TSocketTransport(string host, int port, TConfiguration config, int timeout = 0),这个构造函数直接调用了Dns.GetHostEntry去解析IP地址。
.NET 的 Dns.GetHostAddresses/GetHostEntry 最终依赖底层操作系统的名称解析 API;不同平台的行为并不完全一致。
在linux中 Dns.GetHostEntry(string) 遇到 IP 字符串时,不是简单返回这个 IP,而是会:
先把字符串解析成 IP;
对这个 IP 做一次反向解析拿主机名;
再用这个主机名做一次正向解析拿地址列表。
这个过程中任一步失败,都可能抛 SocketException。
在windows中则会宽松很多。
我现在把我的ip地址写道了/etc/hosts中,定义了一个主机名,现在可以正常连接。
但是这在linux中还是很不友好的,建议不要调用public TSocketTransport(string host, int port, TConfiguration config, int timeout = 0),而是使用public TSocketTransport(string hostNameOrIpAddress, int port, bool connectClient, TConfiguration config, int timeout = 0)代替,这个构造函数先判断hostNameOrIpAddress是不是IP地址,是的话直接使用,不是的话再调用Dns.GetHostEntry,这样linux系统就不用定义主机名了。
- Dominant language
- C#
- Stars
- 24
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iotdb-client-csharp
-
网络波动后导致获取连接失败 Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
apache/iotdb-client-csharp#58 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
apache/iotdb-client-csharp#55 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
apache/iotdb-client-csharp#54 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
apache/iotdb-client-csharp#53 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
apache/iotdb-client-csharp#36 · 1 comment · 1 reaction ·
All issues in apache/iotdb-client-csharp
Similar issues
-
Status: Waiting triage Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
nanoframework/Home#1857 ·
-
kind/bug kind/regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
unoplatform/uno.toolkit.ui#1646 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nightscout/nocturne#1379 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
elastic/esql-dotnet#47 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100