apache / apache/dubbo

NPE around NettyPortUnificationServerHandler.decode

Open
#12,621 5 comments 0 reactions 0 assignees View on GitHub
component/sdk help wanted type/bug
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

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

### Environment

* Dubbo version: 3.1.10
* Operating System version: xxx
* Java version: 1.8

### Steps to reproduce this issue
偶发,有个服务报这个错误,调用方超时

Pls. provide [GitHub address] to reproduce this issue.

### Expected Behavior

### Actual Behavior

If there is an exception, please attach the exception trace:

类名 org.apache.dubbo.remoting.transport.netty4.NettyPortUnificationServerHandler
方法名 NettyServerWorker-7-2
线程名 NettyServerWorker-7-2
内容
[DUBBO] Unexpected exception from downstream before protocol detected., dubbo version: 3.1.10, current host: 172.17.0.1, error code: 99-0. This may be caused by unknown error in remoting module, go to https://dubbo.apache.org/faq/99/0 to find instructions.
io.netty.handler.codec.DecoderException: java.lang.NullPointerException
  at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:471)
  at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
  at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
  at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
  at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
  at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
  at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
  at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
  at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
  at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
  at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
  at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
  at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
  at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
  at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
  at org.apache.dubbo.remoting.transport.netty4.NettyPortUnificationServerHandler.decode(NettyPortUnificationServerHandler.java:100)
  at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501)
  at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440)
  ... 17 more

```
Just put your stack trace here!
```

Contributor guide

Open the contributing guide

Research direction

Start at org.apache.dubbo.remoting.transport.netty4.NettyPortUnificationServerHandler.decode, especially line 100, using the provided Netty DecoderException stack trace and Dubbo 3.1.10 environment details. Investigate the intermittent timeout and null pointer condition; the issue is resolved when the reported decode failure no longer occurs and the behavior is covered by a reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.