You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "sduo (via GitHub)" <gi...@apache.org> on 2024/03/13 01:41:44 UTC
[I] [Bug] 在安装了 OpenVPN 机器的环境下无法获得正确的网卡物理地址导致异常 [rocketmq-clients]
sduo opened a new issue, #702:
URL: https://github.com/apache/rocketmq-clients/issues/702
### Before Creating the Bug Report
- [X] I found a bug, not just asking a question, which should be created in [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
- [X] I have searched the [GitHub Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions) of this repository and believe that this is not a duplicate.
- [X] 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
430ed16c13c407c56a096c599a38cad383b223dd@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 行
```
* 网卡信息
<img width="1189" alt="CFRD-SD_20240313_093231_917" src="https://github.com/apache/rocketmq-clients/assets/11775123/eef1961a-316e-47be-bb87-41c3cf58de6b">
* 物理地址
<img width="1100" alt="CFRD-SD_20240313_093346_854" src="https://github.com/apache/rocketmq-clients/assets/11775123/02046b94-f5ec-4ce7-a57f-716cb3666f19">
* 关键代码
<img width="1189" alt="CFRD-SD_20240313_093511_744" src="https://github.com/apache/rocketmq-clients/assets/11775123/feb996d8-1d16-4bc5-a7c2-23c64109a586">
原因:此处 macAddress 是长度为 0 的数组,向 writer 中要求写入 6 字节,直接导致下标越界。
* 测试用例
<img width="1231" alt="CFRD-SD_20240313_093843_678" src="https://github.com/apache/rocketmq-clients/assets/11775123/4074e411-6a03-406d-85f3-0d3016e66936">
需要加入物理地址的是否为 0 字节的测试。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] 在安装了 OpenVPN 机器的环境下无法获得正确的网卡物理地址导致异常 [rocketmq-clients]
Posted by "lizhanhui (via GitHub)" <gi...@apache.org>.
lizhanhui closed issue #702: [Bug] 在安装了 OpenVPN 机器的环境下无法获得正确的网卡物理地址导致异常
URL: https://github.com/apache/rocketmq-clients/issues/702
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org