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
41313130a3
commit
223422cea3
@ -523,7 +523,10 @@ public abstract class AbstractEpollStreamChannel extends AbstractEpollChannel im
|
||||
allocHandle.readComplete();
|
||||
pipeline.fireChannelReadComplete();
|
||||
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);
|
||||
} else {
|
||||
readIfIsAutoRead();
|
||||
|
@ -568,7 +568,10 @@ public abstract class AbstractKQueueStreamChannel extends AbstractKQueueChannel
|
||||
allocHandle.readComplete();
|
||||
pipeline.fireChannelReadComplete();
|
||||
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);
|
||||
} else {
|
||||
readIfIsAutoRead();
|
||||
|
@ -122,7 +122,10 @@ public abstract class AbstractNioByteChannel extends AbstractNioChannel {
|
||||
allocHandle.readComplete();
|
||||
pipeline.fireChannelReadComplete();
|
||||
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);
|
||||
} else {
|
||||
readIfIsAutoRead();
|
||||
|
Loading…
x
Reference in New Issue
Block a user