codingapi / codingapi/tx-lcn

tc端能正常发送指令,但无法接收到指令 可能是啥原因?

Open
#385 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
4.2k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

- [ ] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.

### 1. Bug Description
在springcloud1.5.9中集成lcn后,启动时报错。tc端接收不到tm端发送的消息?

### 2. Environment:
- JDK version:1.8.0_25
- OS:win10
- TX-LCN version:tx-lcn-5.0.2.RELEASE
- Others:

### 3. Exception Stacktrace
TC端(发送指令正常,但收不到响应):
2019-06-12 23:04:46.068 INFO 23748 --- [ main] c.c.t.t.n.i.NettyRpcClientInitializer : Try connect socket(/127.0.0.1:8070) - count 1
2019-06-12 23:04:46.118 INFO 23748 --- [ Thread-45] c.c.t.tc.txmsg.TCSideRpcInitCallBack : Send init message to TM[/127.0.0.1:8070]
2019-06-12 23:04:46.123 DEBUG 23748 --- [ Thread-45] c.c.t.txmsg.netty.bean.SocketManager : get channel, key:/127.0.0.1:8070
2019-06-12 23:04:46.130 DEBUG 23748 --- [ Thread-45] c.c.t.txmsg.netty.bean.SocketManager : await response
2019-06-12 23:04:46.136 INFO 23748 --- [ main] c.c.txlcn.tc.corelog.txc.TxcLogHelper : Txc log table finish (H2 DATABASE)
2019-06-12 23:04:46.136 INFO 23748 --- [ main] c.c.t.tc.corelog.aspect.AspectLogHelper : Aspect log table finished (H2 DATABASE)
2019-06-12 23:04:46.138 INFO 23748 --- [ main] com.spark.bitrade.DemoApplication : Started DemoApplication in 17.294 seconds (JVM running for 18.618)
2019-06-12 23:04:46.132 DEBUG 23748 --- [ntLoopGroup-2-1] c.c.t.txmsg.netty.handler.RpcCmdEncoder : send->{"key":"2a50d56602537","msg":{"action":"init","data":{"appName":"service-demo","dtxTime":0,"labelName":"service-demo:7777","machineId":0,"seqLen":0,"tmRpcTimeout":0},"state":100},"remoteKey":"/127.0.0.1:8070"}
2019-06-12 23:04:46.302 ERROR 23748 --- [ntLoopGroup-2-1] c.c.t.t.n.h.NettyClientRetryHandler : NettyClientRetryHandler - exception .

java.lang.NoSuchMethodError: io.netty.buffer.ByteBufInputStream.(Lio/netty/buffer/ByteBuf;Z)V
at com.codingapi.txlcn.txmsg.netty.handler.ObjectSerializerDecoder.decode(ObjectSerializerDecoder.java:40) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at com.codingapi.txlcn.txmsg.netty.handler.ObjectSerializerDecoder.decode(ObjectSerializerDecoder.java:31) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:89) ~[netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:242) [netty-codec-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:339) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:324) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:847) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:511) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:468) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:382) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:354) [netty-transport-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:111) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:137) [netty-common-4.0.27.Final.jar:4.0.27.Final]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_191]

2019-06-12 23:04:46.303 DEBUG 23748 --- [ntLoopGroup-2-1] c.c.t.txmsg.netty.handler.RpcCmdEncoder : send->{"key":"383781099251976","msg":{"action":"heartCheck","state":100}}

TM端(发送和接收都正常):
2019-06-12 23:04:46.114 INFO 9184 --- [ntLoopGroup-4-1] io.netty.handler.logging.LoggingHandler : [id: 0xce748c8c, L:/127.0.0.1:8070] READ: [id: 0x8783e1c3, L:/127.0.0.1:8070 - R:/127.0.0.1:61197]
2019-06-12 23:04:46.114 INFO 9184 --- [ntLoopGroup-4-1] io.netty.handler.logging.LoggingHandler : [id: 0xce748c8c, L:/127.0.0.1:8070] READ COMPLETE
2019-06-12 23:04:46.272 DEBUG 9184 --- [ntLoopGroup-5-2] c.c.t.txmsg.netty.handler.RpcCmdDecoder : cmd->{"key":"2a50d56602537","msg":{"action":"init","data":{"appName":"service-demo","dtxTime":0,"labelName":"service-demo:7777","machineId":0,"seqLen":0,"tmRpcTimeout":0},"state":100},"remoteKey":"/127.0.0.1:8070"}
2019-06-12 23:04:46.273 DEBUG 9184 --- [m-rpc-service-2] com.codingapi.txlcn.txmsg.LCNCmdType : parsed txmsg cmd: init
2019-06-12 23:04:46.273 INFO 9184 --- [m-rpc-service-2] c.c.t.t.t.transaction.InitClientService : Registered TC: service-demo:7777
2019-06-12 23:04:46.292 INFO 9184 --- [m-rpc-service-2] c.c.t.t.s.s.impl.ManagerServiceImpl : Acquired machine id 24, max machine id is: 2251799813685246
2019-06-12 23:04:46.295 DEBUG 9184 --- [ntLoopGroup-5-2] c.c.t.txmsg.netty.handler.RpcCmdEncoder : send->{"key":"2a50d56602537","msg":{"action":"init","data":{"appName":"TransactionManager:7970","dtxTime":8000,"labelName":"service-demo:7777","machineId":24,"seqLen":12,"tmRpcTimeout":1000},"state":200},"remoteKey":"/127.0.0.1:61197"}
2019-06-12 23:04:46.304 DEBUG 9184 --- [ntLoopGroup-5-2] c.c.t.txmsg.netty.handler.RpcCmdDecoder : cmd->{"key":"383781099251976","msg":{"action":"heartCheck","state":100}}
java.lang.NullPointerException
at com.codingapi.txlcn.tm.txmsg.EnsureIdGenEngine.onTmReceivedHeart(EnsureIdGenEngine.java:61)
at com.codingapi.txlcn.txmsg.netty.handler.RpcCmdDecoder.channelRead0(RpcCmdDecoder.java:61)
at com.codingapi.txlcn.txmsg.netty.handler.RpcCmdDecoder.channelRead0(RpcCmdDecoder.java:40)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:323)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:297)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:648)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:583)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:500)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:462)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
2019-06-12 23:04:51.097 INFO 9184 --- [ntLoopGroup-4-1] io.netty.handler.logging.LoggingHandler : [id: 0xce748c8c, L:/127.0.0.1:8070] READ: [id: 0x1f8d8b54, L:/127.0.0.1:8070 - R:/127.0.0.1:61202]
2019-06-12 23:04:51.098 INFO 9184 --- [ntLoopGroup-4-1] io.netty.handler.logging.LoggingHandler : [id: 0xce748c8c, L:/127.0.0.1:8070] READ COMPLETE

### 4. Tour Idea

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the TC/TM startup and messaging flow in Spring Cloud 1.5.9 with TX-LCN 5.0.2.RELEASE, then inspect ObjectSerializerDecoder.java:40 and EnsureIdGenEngine.java:61 alongside the reported stack traces. Confirm that the TC receives the TM response and that the Netty message handling no longer raises the shown exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.