我正在尝试将netty版本3.2.5升级到3.6.6。我的一个测试在版本3.5.9中失败并且与3.5.8一起使用。它的测试输出如下。由于某种原因,未收到服务器的响应。
消息发送由空闲处理程序的超时触发。服务器日志(下面)看起来总是一样的。我在github中找不到任何问题。我错过了什么吗?谢谢!若埃尔
ChannelPipelineFactory
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
// logging handler
pipeline.addLast("LOGGER", new LoggingHandler());
// responsible for observing idle timeout - Netty
pipeline.addLast("idleTimeout", new NettyIdleHandler(this.context, this.timer, 0, 0, this.context.getIdleTimeoutSeconds()));
// responsible for reading until SCMP frame is complete
pipeline.addLast("framer", new NettySCMPFrameDecoder());
// executer to run NettyTcpRequesterResponseHandler in own thread
pipeline.addLast("executor", new ExecutionHandler(AppContext.getSCWorkerThreadPool()));
// responsible for handle response - Stabilit
pipeline.addLast("requesterResponseHandler", new NettyTcpRequesterResponseHandler());
return pipeline;
}
3.2.5.Final(目前使用)
2013-06-27 15:13:27.908+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff] OPEN
2013-06-27 15:13:27.918+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff] CONNECT: localhost/127.0.0.1:9000
2013-06-27 15:13:27.968+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] BOUND: /127.0.0.1:1365
2013-06-27 15:13:27.968+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] CONNECTED: localhost/127.0.0.1:9000
2013-06-27 15:13:28.930+0200 [Hashed wheel timer #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22) - (HEXDUMP: 4b5251203030303030303020303030303020312e320a)
2013-06-27 15:13:28.960+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] WRITTEN_AMOUNT: 22
2013-06-27 15:13:28.970+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22) - (HEXDUMP: 4b5253203030303030303020303030303020312e320a)
2013-06-27 15:13:29.380+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 => localhost/127.0.0.1:9000] DISCONNECT
2013-06-27 15:13:29.380+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 :> localhost/127.0.0.1:9000] DISCONNECTED
2013-06-27 15:13:29.380+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 :> localhost/127.0.0.1:9000] UNBOUND
2013-06-27 15:13:29.380+0200 [New I/O client worker #1-1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 :> localhost/127.0.0.1:9000] CLOSED
2013-06-27 15:13:29.390+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:39) - [id: 0x001cdeff, /127.0.0.1:1365 :> localhost/127.0.0.1:9000] CLOSE
3.5.8.Final(仍在工作)
2013-06-27 15:02:38.388+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e] OPEN
2013-06-27 15:02:38.388+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e] CONNECT: localhost/127.0.0.1:9000
2013-06-27 15:02:38.418+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] BOUND: /127.0.0.1:1349
2013-06-27 15:02:38.418+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] CONNECTED: localhost/127.0.0.1:9000
2013-06-27 15:02:39.440+0200 [Hashed wheel timer #2] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4b 52 51 20 30 30 30 30 30 30 30 20 30 30 30 30 |KRQ 0000000 0000|
|00000010| 30 20 31 2e 32 0a |0 1.2. |
+--------+-------------------------------------------------+----------------+
2013-06-27 15:02:39.440+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] WRITTEN_AMOUNT: 22
2013-06-27 15:02:39.460+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4b 52 53 20 30 30 30 30 30 30 30 20 30 30 30 30 |KRS 0000000 0000|
|00000010| 30 20 31 2e 32 0a |0 1.2. |
+--------+-------------------------------------------------+----------------+
2013-06-27 15:02:39.820+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 => localhost/127.0.0.1:9000] DISCONNECT
2013-06-27 15:02:39.830+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 :> localhost/127.0.0.1:9000] DISCONNECTED
2013-06-27 15:02:39.830+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 :> localhost/127.0.0.1:9000] UNBOUND
2013-06-27 15:02:39.830+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 :> localhost/127.0.0.1:9000] CLOSED
2013-06-27 15:02:39.830+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x33e9778e, /127.0.0.1:1349 :> localhost/127.0.0.1:9000] CLOSE
3.5.9.Final(测试失败)
2013-06-27 15:17:00.984+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde] OPEN
2013-06-27 15:17:00.995+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde] CONNECT: localhost/127.0.0.1:9000
2013-06-27 15:17:01.015+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 => localhost/127.0.0.1:9000] BOUND: /127.0.0.1:4332
2013-06-27 15:17:01.015+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 => localhost/127.0.0.1:9000] CONNECTED: localhost/127.0.0.1:9000
2013-06-27 15:17:02.016+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 => localhost/127.0.0.1:9000] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4b 52 51 20 30 30 30 30 30 30 30 20 30 30 30 30 |KRQ 0000000 0000|
|00000010| 30 20 31 2e 32 0a |0 1.2. |
+--------+-------------------------------------------------+----------------+
2013-06-27 15:17:02.016+0200 [New I/O worker #1] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 => localhost/127.0.0.1:9000] WRITTEN_AMOUNT: 22
的 ????? 的
2013-06-27 15:17:02.417+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 => localhost/127.0.0.1:9000] DISCONNECT
2013-06-27 15:17:02.427+0200 [main] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0xacb50bde, /127.0.0.1:4332 :> localhost/127.0.0.1:9000] CLOSE
服务器日志(3.5.9.Final)
2013-06-27 15:17:01.005+0200 [New I/O server boss #2 ([id: 0x08e17840, /127.0.0.1:9000])] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] OPEN
2013-06-27 15:17:01.005+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] BOUND: /127.0.0.1:9000
2013-06-27 15:17:01.005+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] CONNECTED: /127.0.0.1:4332
2013-06-27 15:17:02.026+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4b 52 51 20 30 30 30 30 30 30 30 20 30 30 30 30 |KRQ 0000000 0000|
|00000010| 30 20 31 2e 32 0a |0 1.2. |
+--------+-------------------------------------------------+----------------+
2013-06-27 15:17:02.036+0200 [SC_WORKER thread-3] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] WRITE: BigEndianHeapChannelBuffer(ridx=0, widx=22, cap=22)
+-------------------------------------------------+
| 0 1 2 3 4 5 6 7 8 9 a b c d e f |
+--------+-------------------------------------------------+----------------+
|00000000| 4b 52 53 20 30 30 30 30 30 30 30 20 30 30 30 30 |KRS 0000000 0000|
|00000010| 30 20 31 2e 32 0a |0 1.2. |
+--------+-------------------------------------------------+----------------+
2013-06-27 15:17:02.036+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, /127.0.0.1:4332 => /127.0.0.1:9000] WRITTEN_AMOUNT: 22
2013-06-27 15:17:02.417+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, localhost/127.0.0.1:4332 :> /127.0.0.1:9000] DISCONNECTED
2013-06-27 15:17:02.417+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, localhost/127.0.0.1:4332 :> /127.0.0.1:9000] UNBOUND
2013-06-27 15:17:02.417+0200 [New I/O worker #431] DEBUG (org.jboss.netty.handler.logging.LoggingHandler:33) - [id: 0x0a003af2, localhost/127.0.0.1:4332 :> /127.0.0.1:9000] CLOSED
答案 0 :(得分:0)
发现问题。 阻止线程是一个坏主意:/。在新线程中运行空闲过程可以解决问题。 猜猜它是因为IdleStateEvent现在由工作线程处理,因为它已在3.5.9中根据以下内容进行了更改: https://github.com/netty/netty/issues/641 https://issues.jboss.org/browse/NETTY-362
为什么idleStateEvent没有移交给管道中指定的我自己的工作线程作为执行器“ExecutionHandler”?或者我的错误? THX!