Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] 在安装了 OpenVPN 机器的环境下无法获得正确的网卡物理地址导致异常 #702

Closed
3 tasks done
sduo opened this issue Mar 13, 2024 · 0 comments · Fixed by #704
Closed
3 tasks done
Labels
type/bug Something isn't working

Comments

@sduo
Copy link
Contributor

sduo commented Mar 13, 2024

Before Creating the Bug Report

  • I found a bug, not just asking a question, which should be created in GitHub Discussions.

  • I have searched the GitHub Issues and GitHub Discussions of this repository and believe that this is not a duplicate.

  • I have confirmed that this bug belongs to the current repository, not other repositories of RocketMQ.

Programming Language of the Client

C#

Runtime Platform Environment

  • Windows 11 23H2
  • Tailscale 1.60.1

RocketMQ Version of the Client/Server

430ed16@master

Run or Compiler Version

No response

Describe the Bug

在任何安装了 OpenVPN 的机器上,即网卡的 NetworkInterfaceType 值为 53 的机器上,Utilities.GetMacAddress() 函数中未排除物理地址为空的网卡。导致 MessageIdGenerator 实例化异常。

Steps to Reproduce

安装 tailscale 后,直接执行 examples 项目中的示例。

What Did You Expect to See?

在 Utilities.GetMacAddress() 函数中,排除NetworkInterfaceType 值为 53 的网卡。

What Did You See Instead?

在 Utilities.GetMacAddress() 函数中,加入物理地址的长度检测,如果长度为 0 的话,返回 RandomMacAddressBytes 的值。

Additional Context

  • 异常
One or more errors occurred. (The type initializer for 'Org.Apache.Rocketmq.MessageIdGenerator' threw an exception.)

   在 System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   在 System.Threading.Tasks.Task.Wait()
   在 examples.QuickStart.Main() 在 .\csharp\examples\QuickStart.cs 中: 第 107 行
  • 关键异常
Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.

   在 System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)
   在 System.IO.BinaryWriter.Write(Byte[] buffer, Int32 index, Int32 count)
   在 Org.Apache.Rocketmq.MessageIdGenerator..ctor() 在 .\csharp\rocketmq-client-csharp\MessageIdGenerator.cs 中: 第 46 行
   在 Org.Apache.Rocketmq.MessageIdGenerator..cctor() 在 .\csharp\rocketmq-client-csharp\MessageIdGenerator.cs 中: 第 31 行
  • 网卡信息
CFRD-SD_20240313_093231_917
  • 物理地址
CFRD-SD_20240313_093346_854
  • 关键代码
CFRD-SD_20240313_093511_744 原因:此处 macAddress 是长度为 0 的数组,向 writer 中要求写入 6 字节,直接导致下标越界。
  • 测试用例
CFRD-SD_20240313_093843_678 需要加入物理地址的是否为 0 字节的测试。
@sduo sduo added the type/bug Something isn't working label Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant