Server Connection Issues
Connection failures to DolphinDB servers are typically caused by network issues or insufficient connections.
Network Issues
-
Check Port Status
Use tools like telnet, ssh, and nc to test port connectivity. For example, to test if port 8911 is open on a server with the IP address 192.168.1.206, execute the following command in the Command Prompt (for Windows) or Terminal (for Linux):
telnet 192.168.1.206 8911 //telnet <ip> <port>
Note: You can replace
ip
andport
with the server's IP address and port number.If the connection is established, the Command Prompt goes to a blank screen (in Windows) or
Connected to 192.168.1.206 8911
is displayed in the Terminal (in Linux). -
Check Packet Transmission Rate
Use the
ping
command to send data packets to the server and measure how long they take to return.For Windows users, use:
ping -l 16534 ip
For Linux users, use:
ping -s 16534 ip
For example,to ping the destination
192.168.1.206
:# ping -s 16534 192.168.1.206 PING 192.168.1.206 (192.168.1.206) 16534(16562) bytes of data. 16542 bytes from 192.168.1.206: icmp_seq=1 ttl=61 time=18.9 ms 16542 bytes from 192.168.1.206: icmp_seq=2 ttl=61 time=15.8 ms 16542 bytes from 192.168.1.206: icmp_seq=3 ttl=61 time=16.0 ms
Assuming the network is stable, examine connection capacity as a possible cause of the issue.
Insufficient Connection Capacity
When the number of connections reaches the limit specified bymaxConnections (default: 64 for Windows, 512 for Linux), new connections cannot be established and the following error message is thrown.
"Maximum connections {num} reached. Close unused connections or increase maxConnections limit. RefId:S00006"
You can check for connection leaks by getSessionMemoryStat()
, which
provides the status of all connection sessions. Each session consumes one
connection.
select * from getSessionMemoryStat() where sessionId is not null
If connections fail due to limited maxConnections, you can resort to the following methods:
-
Set a higher maxConnections: Use the
setMaxConnections
function to modify the maximum number of connections to the current node online.Temporarily increase the connection limit by
setMaxConnections
:pnodeRun(setMaxConnections{5000})
-
Close Inactive Connections: Use lastActiveTime to identify inactive sessions and close these connections by
closeSessions
. Alternatively, you can use the ops module:use ops closeInactiveSessions(hours=12)
where the
closeInactiveSessions
function clears connections idle for the specified period (default value is 12 hours). The duration can be adjusted as needed.Note: This approach carries more risk than increasing the connection limit.
Other Situations
If the issue persists after following these steps, try restarting the affected DolphinDB node.