sofastack / sofa-bolt

SOFABolt is a lightweight, easy to use and high performance remoting framework based on Netty.
https://www.sofastack.tech/projects/sofa-bolt/
Apache License 2.0
2.42k stars 861 forks source link

Why "Unknown protocol code: [ProtocolVersion{version=[3]}] while decode in ProtocolDecoder.]" warning message reported in connection-event log file? #332

Closed tongtaodragon closed 11 months ago

tongtaodragon commented 1 year ago

Your question

In our environment, warning message appeared in connection-event log file as below. Unknown protocol code: [ProtocolVersion{version=[3]}] while decode in ProtocolDecoder.] Why report this warning message? What possible kind of situations will trigger this warning message?

Environment

Client: Windows 7

OrezzerO commented 1 year ago

Protocol Version is the first byte of your application layer network frame. Usually it is 1 (for BoltV1) and 2 for (BoltV2 protocol). If the first byte is 3 , bolt can not find the correspond protocol, so you will see this error .

There may be two common causes of this problem :

  1. Some unknown client send wrong packets to your port.
  2. Decoder did not consume all data in one packet, so some wrong data left in cache. The next time Decoder consume data, it read the wrong data.
kelseysunhaha commented 1 year ago

协议版本是应用层网络帧的第一个字节。通常为 1(对于 BoltV1)和 2(对于 BoltV2 协议)。如果第一个字节是 3,bolt 找不到对应的协议,那么你会看到这个错误。

此问题可能有两个常见原因:

  1. 一些未知的客户端向您的端口发送错误的数据包。
  2. 解码器没有消耗掉一个数据包中的所有数据,因此存储器中留下了一些错误的数据。解码器接下来消耗数据时,读取到了错误的数据。