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] Bug title Rocketmq5.3.0 reports an error after configuring IPV6 #8549

Closed
3 tasks done
htxxy1015 opened this issue Aug 16, 2024 · 4 comments · Fixed by #8567
Closed
3 tasks done

[Bug] Bug title Rocketmq5.3.0 reports an error after configuring IPV6 #8549

htxxy1015 opened this issue Aug 16, 2024 · 4 comments · Fixed by #8567

Comments

@htxxy1015
Copy link

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.

Runtime platform environment

centos7.8

RocketMQ version

rocketmq5.3.0

JDK Version

JDK1.8

Describe the Bug

rocketmq5.3.0,brokerIP1配置为IPV6,即brokerIP1=fd00::1:7a,当推完数据到mq后,再查看mq状态时报错。
broker.conf:
image

报错截图:
image

Steps to Reproduce

rocketmq5.3.0,brokerIP1配置为IPV6,即brokerIP1=fd00::1:7a,当推完数据到mq后,再查看mq状态时报错。

What Did You Expect to See?

有解决方案

What Did You See Instead?

有解决方案

Additional Context

No response

@leizhiyuan
Copy link
Contributor

这个错误看着是服务端返回的,去broker的日志里面,看看服务端的报错消息是哪一行

@htxxy1015
Copy link
Author

@leizhiyuan
broker.log日志看起来没有啥问题
image
但在remote.log却存在报错信息。
image

PS:目前就是在broker.conf配置brokerIP1=ipv6地址,生产和消费数据后,查看改mq状态就会提示该报错
当brokerIP1=ipv4地址,这种情况就不会出现

@leizhiyuan
Copy link
Contributor

leizhiyuan commented Aug 20, 2024

应该是这行代码没有考虑ipv6的情况

    @Override
    public long getEarliestMessageTime() {
        long minPhyOffset = this.getMinPhyOffset();
        if (this.getCommitLog() instanceof DLedgerCommitLog) {
            minPhyOffset += DLedgerEntry.BODY_OFFSET;
        }
        final int size = MessageDecoder.MESSAGE_STORE_TIMESTAMP_POSITION + 8;
        return this.getCommitLog().pickupStoreTimestamp(minPhyOffset, size);
    }

这里的是56+8

 public long pickupStoreTimestamp(final long offset, final int size) {
        if (offset >= this.getMinOffset() && offset + size <= this.getMaxOffset()) {
            SelectMappedBufferResult result = this.getMessage(offset, size);
            if (null != result) {
                try {
                    int sysFlag = result.getByteBuffer().getInt(MessageDecoder.SYSFLAG_POSITION);
                    int bornhostLength = (sysFlag & MessageSysFlag.BORNHOST_V6_FLAG) == 0 ? 8 : 20;
                    int msgStoreTimePos = 4 + 4 + 4 + 4 + 4 + 8 + 8 + 4 + 8 + bornhostLength;
                    return result.getByteBuffer().getLong(msgStoreTimePos);
                } finally {
                    result.release();
                }
            }
        }

        return -1;
    }

里面如果是ipv4,获取的是56:56+8(long)
如果是ipv6,就会越界,要获取68:68+8

@htxxy1015
Copy link
Author

@leizhiyuan 下个版本应该包含该问题的解决吧

RongtongJin pushed a commit that referenced this issue Aug 21, 2024
…d be 20 (#8567)

* fix: when ipv6 enabled in broker, pickupStoreTimestamp size should be 12(20-8)

* fix: when ipv6 enabled in broker, pickupStoreTimestamp size should be 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants