teragrep / net_01

Java zero copy networking library
GNU Affero General Public License v3.0
0 stars 1 forks source link

IngressImpl run() threw ClosedChannelException: null #10

Open StrongestNumber9 opened 2 days ago

StrongestNumber9 commented 2 days ago

Describe the bug

Hitting ^C while running tcpflood towards https://github.com/kortemik/cfe_35/tree/to-9

+11:05:11.747 [pool-2-thread-1] ERROR com.teragrep.net_01.channel.context.IngressImpl - run() threw
java.net.SocketException: Connection reset
        at sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:401) ~[?:?]
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:478) ~[?:?]
        at java.nio.channels.SocketChannel.read(SocketChannel.java:630) ~[?:?]
        at com.teragrep.net_01.channel.socket.PlainSocket.read(PlainSocket.java:65) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.readData(IngressImpl.java:237) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.run(IngressImpl.java:103) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
11:05:11.749 [pool-2-thread-1] ERROR com.teragrep.net_01.channel.context.IngressImpl - run() threw
java.nio.channels.ClosedChannelException: null
        at sun.nio.ch.SocketChannelImpl.ensureOpenAndConnected(SocketChannelImpl.java:222) ~[?:?]
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:454) ~[?:?]
        at java.nio.channels.SocketChannel.read(SocketChannel.java:630) ~[?:?]
        at com.teragrep.net_01.channel.socket.PlainSocket.read(PlainSocket.java:65) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.readData(IngressImpl.java:237) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.run(IngressImpl.java:103) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]

11:05:21.202 [pool-2-thread-1] ERROR com.teragrep.net_01.channel.context.IngressImpl - run() threw
java.nio.channels.ClosedChannelException: null
        at sun.nio.ch.SocketChannelImpl.ensureOpenAndConnected(SocketChannelImpl.java:222) ~[?:?]
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:454) ~[?:?]
        at java.nio.channels.SocketChannel.read(SocketChannel.java:630) ~[?:?]
        at com.teragrep.net_01.channel.socket.PlainSocket.read(PlainSocket.java:65) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.readData(IngressImpl.java:237) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.run(IngressImpl.java:103) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]
11:05:26.730 [pool-2-thread-1] ERROR com.teragrep.net_01.channel.context.IngressImpl - run() threw
java.nio.channels.ClosedChannelException: null
        at sun.nio.ch.SocketChannelImpl.ensureOpenAndConnected(SocketChannelImpl.java:222) ~[?:?]
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:454) ~[?:?]
        at java.nio.channels.SocketChannel.read(SocketChannel.java:630) ~[?:?]
        at com.teragrep.net_01.channel.socket.PlainSocket.read(PlainSocket.java:65) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.readData(IngressImpl.java:237) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at com.teragrep.net_01.channel.context.IngressImpl.run(IngressImpl.java:103) ~[cfe_35.jar:0.0.1-SNAPSHOT]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1583) ~[?:?]

Expected behavior

Graceful disconnection handling

How to reproduce

Run server java -Dcfe07LookupPath=src/test/resources/cfe_07 -Dcfe16LookupPath=src/test/resources/cfe_16 -Dkin02LookupPath=src/test/resources/kin_02 -DroutingTargetsConfig=src/test/resources/targetsPerformanceTest.json -DlistenPort=4600 -jar target/cfe_35.jar

Run tcpflood and interrupt it with ^C tcpflood -t 127.0.0.1 -T relp-plain -p 4600 -m 10000000 -M "<14>1 2020-05-15T13:24:03.603Z performance-test-host performance-test-tag - - - hello

Software version

cfe_35 commit 2eba9c65400b1496ca23d4a295378b2c59891d00 (HEAD -> to-9, origin/to-9) rlp_03 8.0.0

Additional context

StrongestNumber9 commented 1 day ago

It is easy to reproduce when using a Consumer<FrameContext> that takes a while to process, like with Thread.sleep(5000); and then just closing the connection