I am using a NioSctpServerChannel connection with Netty between two different machines. The connection is established successfully and receives data after the client's channelActive-Handler sends some data to the server.
The receiving interface seems to be another than the binding interface (192.168.122.1 instead of 192.168.243.31) - is this a system or netty problem?
Then a heartbeat is sent via a complete different interface (in this case a virbr 192.168.122.1) and is answered with an abort which destroys the connection. When the client tries to send a heartbeat this is logically also answered with an abort since the connection is already down.
PC1 192.168.243.31 (Server) PC2 192.168.243.12 (Client)
Server Init Code:
public void run() throws Exception {
EventLoopGroup bossGroup = new NioEventLoopGroup(1);
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioSctpServerChannel.class)
.option(ChannelOption.SO_BACKLOG, 100)
.handler(new LoggingHandler(LogLevel.INFO))
.option(ChannelOption.SO_KEEPALIVE, true)
.childHandler(new ChannelInitializer<SctpChannel>() {
@Override
public void initChannel(SctpChannel ch) throws Exception {
ch.pipeline().addLast(new Handler1());
ch.pipeline().addLast(new Handler2());
ch.pipeline().addLast(new Handler3());
}
});
System.out.println("Connector binding...");
ChannelFuture f = b.bind("192.168.243.31", port).sync();
f.channel().closeFuture().sync();
} finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
System.out.println("Connector ended.");
}
LOG Output:
Running Staging Server ...
Connector binding...
Jul 03, 2014 8:05:27 AM io.netty.handler.logging.LoggingHandler channelRegistered
INFO: [id: 0xef4ebad6] REGISTERED
Jul 03, 2014 8:05:27 AM io.netty.handler.logging.LoggingHandler bind
INFO: [id: 0xef4ebad6] BIND: /192.168.243.31:8090
Jul 03, 2014 8:05:27 AM io.netty.handler.logging.LoggingHandler channelActive
INFO: [id: 0xef4ebad6, /192.168.243.31:8090] ACTIVE
Jul 03, 2014 8:05:33 AM io.netty.handler.logging.LoggingHandler channelRead
INFO: [id: 0xef4ebad6, /192.168.243.31:8090] RECEIVED: [id: 0x2a9c7ea3, /192.168.122.1:49423 => /192.168.243.31:8090]
HandlerActive
Data rx:
--------------------------------------------------------------------------------
00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
0000 a8 2b 0a 31 03 32 03 16 0d 28 36 .+.1.2...(6
--------------------------------------------------------------------------------
java.net.SocketException: Connection reset by peer
at sun.nio.ch.sctp.SctpChannelImpl.receive0(Native Method)
at sun.nio.ch.sctp.SctpChannelImpl.receiveIntoNativeBuffer(SctpChannelImpl.java:860)
at sun.nio.ch.sctp.SctpChannelImpl.receive(SctpChannelImpl.java:836)
at sun.nio.ch.sctp.SctpChannelImpl.receive(SctpChannelImpl.java:779)
at sun.nio.ch.sctp.SctpChannelImpl.receive(SctpChannelImpl.java:741)
at io.netty.channel.sctp.nio.NioSctpChannel.doReadMessages(NioSctpChannel.java:278)
at io.netty.channel.nio.AbstractNioMessageChannel$NioMessageUnsafe.read(AbstractNioMessageChannel.java:73)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:485)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:794)
at java.lang.Thread.run(Thread.java:745)
channelInactive
network configuration:
br1 Link encap:Ethernet HWaddr 00:e0:7d:ae:bc:6f
inet addr:10.10.0.1 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::2e0:7dff:feae:bc6f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11 errors:0 dropped:0 overruns:0 frame:0
TX packets:38 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:506 (506.0 B) TX bytes:7288 (7.2 KB)
br2 Link encap:Ethernet HWaddr 64:31:50:3f:4e:01
inet addr:192.168.243.31 Bcast:192.168.243.255 Mask:255.255.255.0
inet6 addr: fe80::6631:50ff:fe3f:4e01/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:96536 errors:0 dropped:0 overruns:0 frame:0
TX packets:54325 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:102780133 (102.7 MB) TX bytes:19776526 (19.7 MB)
eth0 Link encap:Ethernet HWaddr 00:e0:7d:ae:bc:6f
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:274 errors:0 dropped:0 overruns:0 frame:0
TX packets:849 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16440 (16.4 KB) TX bytes:61267 (61.2 KB)
eth1 Link encap:Ethernet HWaddr 64:31:50:3f:4e:01
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:121985 errors:0 dropped:68 overruns:0 frame:0
TX packets:60157 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:106326525 (106.3 MB) TX bytes:20402116 (20.4 MB)
Interrupt:19 Memory:f0100000-f0120000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:444 errors:0 dropped:0 overruns:0 frame:0
TX packets:444 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:53204 (53.2 KB) TX bytes:53204 (53.2 KB)
virbr0 Link encap:Ethernet HWaddr 82:34:aa:4d:49:4e
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Network traffic:
1444 27.462912000 192.168.243.12 192.168.243.31 SCTP 116 INIT
1445 27.463024000 192.168.243.31 192.168.243.12 SCTP 340 INIT_ACK
1446 27.463030000 192.168.243.31 192.168.243.12 SCTP 340 INIT_ACK
1447 27.463702000 192.168.243.12 192.168.243.31 SCTP 312 COOKIE_ECHO
1448 27.463702000 192.168.243.12 192.168.243.31 SCTP 312 COOKIE_ECHO
1449 27.463786000 192.168.243.31 192.168.243.12 SCTP 52 COOKIE_ACK
1450 27.463798000 192.168.243.31 192.168.243.12 SCTP 52 COOKIE_ACK
1451 27.469117000 192.168.243.12 192.168.243.31 SCTP 76 DATA
1452 27.469117000 192.168.243.12 192.168.243.31 SCTP 76 DATA
1453 27.469160000 192.168.243.31 192.168.243.12 SCTP 64 SACK
1454 27.469164000 192.168.243.31 192.168.243.12 SCTP 64 SACK
1520 30.097581000 192.168.243.31 192.168.122.1 SCTP 100 HEARTBEAT
1521 30.097638000 192.168.122.1 192.168.243.31 SCTP 52 ABORT
2184 59.710594000 192.168.243.12 192.168.243.31 SCTP 96 HEARTBEAT
2185 59.710594000 192.168.243.12 192.168.243.31 SCTP 96 HEARTBEAT
2186 59.710638000 192.168.243.31 192.168.243.12 SCTP 52 ABORT
2187 59.710641000 192.168.243.31 192.168.243.12 SCTP 52 ABORT 1