Enhancement: Add Configurable Timeout to Socket Connection Methods #153
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The ORB does not set a timeout when establishing a connection, and in some cases, such as when the opposite endpoint has set up firewall rules or is connecting to a non-existent IP address, the connection process will block for a long time at the native method:
By using tcpdump to capture packets, it was discovered that the kernel was constantly performing TCP retransmissions, with the number of retransmissions being controlled by the kernel parameter
net.ipv4.tcp_syn_retries
and using an exponential backoff strategy. On my machine, it takes 130 seconds for the timeout to occur.Therefore a configurable timeout should be set for the connection process. In fact, ORB already has a configurable property com.sun.corba.ee.transport.ORBTCPConnectTimeouts, but the connection process does not currently utilize this parameter.
This PR introduces a significant enhancement to the socket connection methods, providing more flexibility and control over socket connections.Additionally I add unit tests to ensure the correct functionality of the updated methods. These tests cover both normal operation and timeout scenarios.