Skip to content

Commit

Permalink
pool: remove IdleHandler from http and xroot movers
Browse files Browse the repository at this point in the history
Motivation:
Two reasons why idle connection handler is not needed:

- pool provides `jtm` which can be use to achieve the same behavoir

- idle timeouts in general makes no sense with posix access, as
  multi-hour jobs can keep files open for the whole duration
  of the execution.

Modification:
Remove IdleHandler from Http/XrootdTransferService clases. Update
supporting code to obsolete the corresponding properties.

Result:
More predictable user job behaviour.

Ticket: #10533
Acked-by: Marina Sahakyan
Target: master
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Jan 9, 2024
1 parent ffbbf5c commit 0bbf8f5
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013-2023 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013-2024 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -40,7 +40,6 @@
import io.netty.channel.ChannelPipeline;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.timeout.IdleStateHandler;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand Down Expand Up @@ -431,10 +430,7 @@ protected void initChannel(Channel ch) throws Exception {
pipeline.addLast("plugin:" + plugin.getName(),
plugin.createHandler());
}
pipeline.addLast("timeout", new IdleStateHandler(0,
0,
clientIdleTimeout,
clientIdleTimeoutUnit));

pipeline.addLast("chunkedWriter", new ChunkedResponseWriteHandler());

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
import io.netty.handler.codec.http.QueryStringDecoder;
import io.netty.handler.timeout.IdleState;
import io.netty.handler.timeout.IdleStateEvent;
import io.netty.handler.timeout.IdleStateHandler;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
Expand Down Expand Up @@ -797,11 +796,6 @@ private Object read(ChannelHandlerContext context, NettyTransferService<HttpProt
long length = (upperRange - lowerRange) + 1;

if (_useZeroCopy) {
// disable timeout manager as zero-copy can't keep idle counters in sync
var hasIdleStateHandler = context.channel().pipeline().get(IdleStateHandler.class) != null;
if (hasIdleStateHandler) {
context.channel().pipeline().remove(IdleStateHandler.class);
}
return asFileRegion(file, lowerRange, length);
}
return new ReusableChunkedNioFile(file, lowerRange, length, _chunkSize);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013-2023 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013-2024 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -38,7 +38,6 @@
import io.netty.handler.codec.http.cors.CorsHandler;
import io.netty.handler.logging.LoggingHandler;
import io.netty.handler.stream.ChunkedWriteHandler;
import io.netty.handler.timeout.IdleStateHandler;

import java.net.InetSocketAddress;
import java.net.SocketException;
Expand Down Expand Up @@ -166,11 +165,6 @@ protected void addChannelHandlers(ChannelPipeline pipeline) throws Exception {
if (LOGGER.isDebugEnabled()) {
pipeline.addLast("logger", new LoggingHandler());
}
pipeline.addLast("idle-state-handler",
new IdleStateHandler(0,
0,
clientIdleTimeout,
clientIdleTimeoutUnit));
pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
pipeline.addLast("keepalive", new KeepAliveHandler());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* dCache - http://www.dcache.org/
*
* Copyright (C) 2013 - 2023 Deutsches Elektronen-Synchrotron
* Copyright (C) 2013 - 2024 Deutsches Elektronen-Synchrotron
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
Expand Down Expand Up @@ -192,24 +192,6 @@ public void setPostTransferService(
this.postTransferService = postTransferService;
}

public long getClientIdleTimeout() {
return clientIdleTimeout;
}

@Required
public void setClientIdleTimeout(long clientIdleTimeout) {
this.clientIdleTimeout = clientIdleTimeout;
}

public TimeUnit getClientIdleTimeoutUnit() {
return clientIdleTimeoutUnit;
}

@Required
public void setClientIdleTimeoutUnit(TimeUnit clientIdleTimeoutUnit) {
this.clientIdleTimeoutUnit = clientIdleTimeoutUnit;
}

public long getConnectTimeout() {
return connectTimeout;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@
<property name="postTransferService" ref="post-transfer-service"/>
<property name="pnfsStub" ref="pnfsStub"/>
<property name="threads" value="${pool.mover.xrootd.threads}"/>
<property name="clientIdleTimeout" value="${pool.mover.xrootd.timeout.idle}"/>
<property name="clientIdleTimeoutUnit" value="${pool.mover.xrootd.timeout.idle.unit}"/>
<property name="connectTimeout" value="${pool.mover.xrootd.timeout.connect}"/>
<property name="connectTimeoutUnit" value="${pool.mover.xrootd.timeout.connect.unit}"/>
<property name="tpcClientChunkSize" value="#{ byteSizeParser.parse('${pool.mover.xrootd.tpc-client-chunk-size}') }"/>
Expand Down Expand Up @@ -459,8 +457,6 @@
<property name="postTransferService" ref="post-transfer-service"/>
<property name="threads" value="${pool.mover.http.threads}"/>
<property name="chunkSize" value="${pool.mover.http.chunk-size}"/>
<property name="clientIdleTimeout" value="${pool.mover.http.timeout.idle}"/>
<property name="clientIdleTimeoutUnit" value="${pool.mover.http.timeout.idle.unit}"/>
<property name="connectTimeout" value="${pool.mover.http.timeout.connect}"/>
<property name="connectTimeoutUnit" value="${pool.mover.http.timeout.connect.unit}"/>
<property name="doorStub" ref="doorStub"/>
Expand Down
19 changes: 4 additions & 15 deletions skel/share/defaults/pool.properties
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,6 @@ pool.mover.xrootd.plugins=
#
pool.mover.xrootd.tpc-authn-plugins=gsi,unix,ztn

# ---- xroot mover-idle timeout
#
# Specifies the timeout before clients that connect to the
# pool request handler but don't open any files will be disconnected.
#
pool.mover.xrootd.timeout.idle = 300000
(one-of?MILLISECONDS|SECONDS|MINUTES|HOURS|DAYS)pool.mover.xrootd.timeout.idle.unit=MILLISECONDS

# ---- xroot connect timeout
#
# Timeout that the mover will wait for a client connection before
Expand Down Expand Up @@ -519,13 +511,6 @@ pool.mover.http.chunk-size = 8192
(prefix)pool.mover.http.custom-response-header = HTTP headers that are always included in dCache responses
pool.mover.http.custom-response-header!Server = dCache/${dcache.version}

# ---- HTTP client timeout
#
# Period after which a client will be disconnected if the
# connection is idle (not reading or writing)
#
pool.mover.http.timeout.idle = 300
(one-of?MILLISECONDS|SECONDS|MINUTES|HOURS|DAYS)pool.mover.http.timeout.idle.unit = SECONDS

# ---- HTTP connect timeout
#
Expand Down Expand Up @@ -792,6 +777,10 @@ pool.info-request-handler.threads=4
# Obsolete properties
(obsolete)pool.cell.export = See pool.cell.consume
(obsolete)pool.enable.remove-precious-files-on-delete = Precious replicas are always removed when file deleted in the namespace.
(obsolete)pool.mover.xrootd.timeout.idle=The property is obsolete, use job timeout manager (jtm) instead.
(obsolete)pool.mover.xrootd.timeout.idle.unit=The property is obsolete, use job timeout manager (jtm) instead.
(obsolete)pool.mover.http.timeout.idle=The property is obsolete, use job timeout manager (jtm) instead.
(obsolete)pool.mover.http.timeout.idle.unit=The property is obsolete, use job timeout manager (jtm) instead.



Expand Down
4 changes: 0 additions & 4 deletions skel/share/services/pool.batch
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ check -strong pool.mover.ftp.allow-incoming-connections
check -strong pool.mover.ftp.mmap
check -strong pool.mover.ftp.read-ahead
check -strong pool.mover.xrootd.threads
check -strong pool.mover.xrootd.timeout.idle
check -strong pool.mover.xrootd.timeout.idle.unit
check -strong pool.mover.xrootd.timeout.connect
check -strong pool.mover.xrootd.timeout.connect.unit
check -strong pool.mover.xrootd.read-reconnect-timeout
Expand All @@ -66,8 +64,6 @@ check -strong pool.mover.xrootd.security.tls.require-data
check -strong pool.mover.xrootd.security.tls.require-gpf
check -strong pool.mover.xrootd.security.tls.require-tpc
check -strong pool.mover.http.threads
check -strong pool.mover.http.timeout.idle
check -strong pool.mover.http.timeout.idle.unit
check -strong pool.mover.http.timeout.connect
check -strong pool.mover.http.timeout.connect.unit
check -strong pool.mover.http.chunk-size
Expand Down

0 comments on commit 0bbf8f5

Please sign in to comment.