Motivation: When we were using the netty http protocol, OOM occurred, this problem has been in 4.1.51.Final Fix [# 10424](https://github.com/netty/netty/issues/10424), even if OOM is up, the service will still receive new connection events, will occur again OOM and eventually cause the connection not to be released. code `byteBuf = allocHandle.allocate(allocator);` Modification: I fail to create buffer when I try to receive new data, i determine if it is OOM then the close read event releases the connection. ```java if (close || cause instanceof OutOfMemoryError || cause instanceof IOException) { closeOnRead(pipeline); } ``` Result: Fixes # [10434](https://github.com/netty/netty/issues/10434).
This commit is contained in:
parent
61b0fa97d7
commit
54bfd21e52
@ -726,7 +726,10 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
|||||||
allocHandle.readComplete();
|
allocHandle.readComplete();
|
||||||
pipeline.fireChannelReadComplete();
|
pipeline.fireChannelReadComplete();
|
||||||
pipeline.fireExceptionCaught(cause);
|
pipeline.fireExceptionCaught(cause);
|
||||||
if (close || cause instanceof IOException) {
|
|
||||||
|
// If oom will close the read event, release connection.
|
||||||
|
// See https://github.com/netty/netty/issues/10434
|
||||||
|
if (close || cause instanceof OutOfMemoryError || cause instanceof IOException) {
|
||||||
shutdownInput(false);
|
shutdownInput(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -587,7 +587,10 @@ public abstract class AbstractKQueueStreamChannel extends AbstractKQueueChannel
|
|||||||
allocHandle.readComplete();
|
allocHandle.readComplete();
|
||||||
pipeline.fireChannelReadComplete();
|
pipeline.fireChannelReadComplete();
|
||||||
pipeline.fireExceptionCaught(cause);
|
pipeline.fireExceptionCaught(cause);
|
||||||
if (close || cause instanceof IOException) {
|
|
||||||
|
// If oom will close the read event, release connection.
|
||||||
|
// See https://github.com/netty/netty/issues/10434
|
||||||
|
if (close || cause instanceof OutOfMemoryError || cause instanceof IOException) {
|
||||||
shutdownInput(false);
|
shutdownInput(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,10 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
|||||||
allocHandle.readComplete();
|
allocHandle.readComplete();
|
||||||
pipeline.fireChannelReadComplete();
|
pipeline.fireChannelReadComplete();
|
||||||
pipeline.fireExceptionCaught(cause);
|
pipeline.fireExceptionCaught(cause);
|
||||||
if (close || cause instanceof IOException) {
|
|
||||||
|
// If oom will close the read event, release connection.
|
||||||
|
// See https://github.com/netty/netty/issues/10434
|
||||||
|
if (close || cause instanceof OutOfMemoryError || cause instanceof IOException) {
|
||||||
closeOnRead(pipeline);
|
closeOnRead(pipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,10 @@ public abstract class AbstractOioByteChannel extends AbstractOioChannel {
|
|||||||
allocHandle.readComplete();
|
allocHandle.readComplete();
|
||||||
pipeline.fireChannelReadComplete();
|
pipeline.fireChannelReadComplete();
|
||||||
pipeline.fireExceptionCaught(cause);
|
pipeline.fireExceptionCaught(cause);
|
||||||
if (close || cause instanceof IOException) {
|
|
||||||
|
// If oom will close the read event, release connection.
|
||||||
|
// See https://github.com/netty/netty/issues/10434
|
||||||
|
if (close || cause instanceof OutOfMemoryError || cause instanceof IOException) {
|
||||||
closeOnRead(pipeline);
|
closeOnRead(pipeline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user