five111 opened a new issue #2654:
URL: https://github.com/apache/servicecomb-java-chassis/issues/2654
### 背景如下
应用在现网跑了一段时间 偶现
io.netty.channel.connecttimeoutexception connection timed out
应该是tcp连接超时了 具体发送请求仅过去了1s 查看netty源码如下
```
@Override
public final void connect(
final SocketAddress remoteAddress, final SocketAddress
localAddress, final ChannelPromise promise) {
if (!promise.setUncancellable() || !ensureOpen(promise)) {
return;
}
try {
if (connectPromise != null) {
// Already a connect in process.
throw new ConnectionPendingException();
}
boolean wasActive = isActive();
if (doConnect(remoteAddress, localAddress)) {
fulfillConnectPromise(promise, wasActive);
} else {
connectPromise = promise;
requestedRemoteAddress = remoteAddress;
// Schedule connect timeout.
int connectTimeoutMillis =
config().getConnectTimeoutMillis();
if (connectTimeoutMillis > 0) {
connectTimeoutFuture = eventLoop().schedule(new
Runnable() {
@Override
public void run() {
ChannelPromise connectPromise =
AbstractNioChannel.this.connectPromise;
if (connectPromise != null &&
!connectPromise.isDone()
&& connectPromise.tryFailure(new
ConnectTimeoutException(
"connection timed out: " +
remoteAddress))) {
close(voidPromise());
}
}
}, connectTimeoutMillis, TimeUnit.MILLISECONDS);
}
promise.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future)
throws Exception {
if (future.isCancelled()) {
if (connectTimeoutFuture != null) {
connectTimeoutFuture.cancel(false);
}
connectPromise = null;
close(voidPromise());
}
}
});
}
} catch (Throwable t) {
promise.tryFailure(annotateConnectException(t,
remoteAddress));
closeIfClosed();
}
}
```
netty 的默认配置应该是 30s
```
int connectTimeoutMillis = config().getConnectTimeoutMillis();
@Override
public int getConnectTimeoutMillis() {
return connectTimeoutMillis;
}
private volatile int connectTimeoutMillis = DEFAULT_CONNECT_TIMEOUT;
private static final int DEFAULT_CONNECT_TIMEOUT = 30000;
```
请问是否是java-chassis做了一层配置 ,如果是 该如何修改这个超时时间
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]