Skip to content

Commit ca35fca

Browse files
authored
Do not set SO_LINGER to 0 when not shutting down (#26871)
This is a follow up to #26764. That commit set SO_LINGER to 0 in order to fix a scenario where we were running out of resources during CI. We are primarily interested in setting this to 0 when stopping the tranport. Allowing TIMED_WAIT is standard for other failure scenarios during normal operation. Unfortunately this commit set SO_LINGER to 0 every time we close NodeChannels. NodeChannels can be closed in case of an exception or other failures (such as parsing a response). We want to only disable linger when actually shutting down.
1 parent 17b9baf commit ca35fca

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/java/org/elasticsearch/transport/TcpTransport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ public Channel channel(TransportRequestOptions.Type type) {
441441
public void close() throws IOException {
442442
if (closed.compareAndSet(false, true)) {
443443
try {
444-
closeChannels(Arrays.stream(channels).filter(Objects::nonNull).collect(Collectors.toList()), false, true);
444+
closeChannels(Arrays.stream(channels).filter(Objects::nonNull).collect(Collectors.toList()), false,
445+
lifecycle.stopped());
445446
} finally {
446447
transportService.onConnectionClosed(this);
447448
}

0 commit comments

Comments
 (0)