You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "dao-jun (via GitHub)" <gi...@apache.org> on 2025/06/25 09:33:11 UTC
[I] [Bug] Pulsar broker mac mismatch when read entry from Bookkeeper [pulsar]
dao-jun opened a new issue, #24464:
URL: https://github.com/apache/pulsar/issues/24464
### Search before reporting
- [x] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Read release policy
- [x] I understand that [unsupported versions](https://pulsar.apache.org/contribute/release-policy/#supported-versions) don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
### User environment
Pulsar broker 3.0.12 with KoP
Bookkeeper 4.16.4
### Issue Description
We set TTL and retention to retain 1 day data.
And set `bookkeeperClientTimeoutInSeconds`, `managedLedgerAddEntryTimeoutSeconds` and `managedLedgerReadEntryTimeoutSeconds` to 30.
We found some error logs in our broker:
```txt
2025-06-05T23:34:15,638+0800 [BookKeeperClientWorker-OrderedExecutor-87-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6545646, entry-id: 9085
2025-06-05T23:34:46,814+0800 [BookKeeperClientWorker-OrderedExecutor-87-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6545646, entry-id: 10208
2025-06-05T23:35:08,865+0800 [BookKeeperClientWorker-OrderedExecutor-89-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6546035, entry-id: 2226
2025-06-05T23:36:20,565+0800 [BookKeeperClientWorker-OrderedExecutor-68-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6545801, entry-id: 5954
2025-06-05T23:36:22,456+0800 [BookKeeperClientWorker-OrderedExecutor-68-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6545801, entry-id: 5971
2025-06-05T23:38:13,132+0800 [BookKeeperClientWorker-OrderedExecutor-24-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6538416, entry-id: 7660
2025-06-05T23:39:07,811+0800 [BookKeeperClientWorker-OrderedExecutor-24-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6538416, entry-id: 8212
2025-06-05T23:40:50,904+0800 [BookKeeperClientWorker-OrderedExecutor-24-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6538416, entry-id: 9090
2025-06-05T23:41:18,761+0800 [BookKeeperClientWorker-OrderedExecutor-0-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6546049, entry-id: 2173
2025-06-05T23:41:29,022+0800 [BookKeeperClientWorker-OrderedExecutor-65-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547331, entry-id: 726
2025-06-05T23:42:43,723+0800 [BookKeeperClientWorker-OrderedExecutor-4-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6539528, entry-id: 1928
2025-06-05T23:44:05,167+0800 [BookKeeperClientWorker-OrderedExecutor-2-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547588, entry-id: 1048
2025-06-05T23:44:17,130+0800 [BookKeeperClientWorker-OrderedExecutor-65-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547331, entry-id: 1454
2025-06-05T23:44:24,529+0800 [BookKeeperClientWorker-OrderedExecutor-2-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547588, entry-id: 2122
2025-06-05T23:45:30,965+0800 [BookKeeperClientWorker-OrderedExecutor-42-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6539604, entry-id: 3122
2025-06-05T23:46:20,720+0800 [BookKeeperClientWorker-OrderedExecutor-42-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6539604, entry-id: 3766
2025-06-05T23:51:59,317+0800 [BookKeeperClientWorker-OrderedExecutor-77-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547354, entry-id: 7198
2025-06-05T23:54:28,204+0800 [BookKeeperClientWorker-OrderedExecutor-19-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547622, entry-id: 5642
2025-06-05T23:55:04,648+0800 [BookKeeperClientWorker-OrderedExecutor-42-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6539604, entry-id: 12005
2025-06-05T23:59:35,261+0800 [BookKeeperClientWorker-OrderedExecutor-65-0] ERROR org.apache.bookkeeper.proto.checksum.DigestManager - Digest mismatch for ledger-id: 6547331, entry-id: 5605
```
### Error messages
```text
```
### Reproducing the issue
NONE
### Additional information
_No response_
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
--
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@pulsar.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3100626229
We can close this issue now, since it's not a pulsar issue
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3004096428
related to:
https://github.com/apache/pulsar/issues/21421
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "zhannao456 (via GitHub)" <gi...@apache.org>.
zhannao456 commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3095516493
@lhotari @dao-jun
This issue is not a pulsar issue. it's kop's issue.
The offset field in Kafka messages has been modified due to Pulsar's write cache, which caches the message body from the business logic. For tailing consumers, messages are read directly from the Pulsar cache. Since the BookKeeper client is configured with ack=1, a message becomes visible to consumers once it is written to a single replica. This can lead to a race condition: an entry is successfully written to bk1 (CRC check completed), and the consumer retrieves the message from the cache and sets the start offset. However, when the entry is later written to bk2, the two replicas may end up with inconsistent message content.
https://github.com/streamnative/kop/blob/14f9832d8a437c5b717e3c74fd7e4cda9810aff7/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/format/AbstractEntryFormatter.java#L70C21-L70C28
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "lhotari (via GitHub)" <gi...@apache.org>.
lhotari commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3004174402
> We are using KoP, so we have a `AppendIndexMetadataInterceptor`.
@dao-jun I think @BewareMyPower might be aware of issues with this. perhaps something related to your previous discussion in https://github.com/apache/pulsar/pull/23940#issuecomment-2642000795 .
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3095518289
@lhotari @dao-jun
This issue is not a pulsar issue. it's kop's issue.
The offset field in Kafka messages has been modified due to Pulsar's write cache, which caches the message body from the business logic. For tailing consumers, messages are read directly from the Pulsar cache. Since the BookKeeper client is configured with ack=1, a message becomes visible to consumers once it is written to a single replica. This can lead to a race condition: an entry is successfully written to bk1 (CRC check completed), and the consumer retrieves the message from the cache and sets the start offset. However, when the entry is later written to bk2, the two replicas may end up with inconsistent message content.
https://github.com/streamnative/kop/blob/14f9832d8a437c5b717e3c74fd7e4cda9810aff7/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/format/AbstractEntryFormatter.java#L70C21-L70C28
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3004095828
related to:
https://github.com/apache/pulsar/issues/21421
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin closed issue #24464: [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper
URL: https://github.com/apache/pulsar/issues/24464
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3004124642
> The problem reminds of issues that I faced in
> https://github.com/apache/pulsar/issues/10738/https://github.com/apache/pulsar/pull/10755 along time ago. The problem is
> most likely different, but that might give some ideas of ways to reproduce the issue.
> Do you get any sign of IllegalReferenceCountException in logs as a result of double releasing buffers?
I dont find memory leaks and `IllegalReferenceCountException` in the broker side, seems it's not caused by memory leak.
> Do you happen to have a ManagedLedgerInterceptor configured?
We are using KoP, so we have a `AppendIndexMetadataInterceptor`.
> When looking at the code, I think I see multiple concerns in the OpAddEntry.run method and using timeouts.
> It seems that the currentLedgerTimeoutTriggered solution added in https://github.com/apache/pulsar/pull/22221 is
> incomplete.
> I don't see how things could work properly when managedLedgerAddEntryTimeoutSeconds is enabled. We can continue to
> discuss that on the new GitHub issue.
I've read the code, seems it will not release the ByteBuf before write to Bookie, I personally think it's fine
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "dao-jun (via GitHub)" <gi...@apache.org>.
dao-jun commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3100630788
@gaozhangmin @BewareMyPower Thanks for your sharing, it would helps a lot!
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] Pulsar broker prints mac mismatch error when read entry from Bookkeeper [pulsar]
Posted by "BewareMyPower (via GitHub)" <gi...@apache.org>.
BewareMyPower commented on issue #24464:
URL: https://github.com/apache/pulsar/issues/24464#issuecomment-3097212425
Yes, this issue can be resolved by creating a short buffer rather than modifying the original entry's buffer like https://github.com/streamnative/kop/blob/14f9832d8a437c5b717e3c74fd7e4cda9810aff7/kafka-impl/src/main/java/io/streamnative/pulsar/handlers/kop/format/AbstractEntryFormatter.java#L70
In our internal fork (KSN), it's fixed by adding a buffer list abstraction:
```java
private final List<ByteBuf> bufferList;
public void addLong(long value) {
final var buffer = ALLOCATOR.buffer(8);
bufferList.add(buffer);
buffer.writeLong(value);
}
public void addSlice(ByteBuf buffer, int startOffset) {
bufferList.add(buffer.retainedSlice(buffer.readerIndex() + startOffset, buffer.readableBytes() - startOffset));
}
```
and merge the buffers added in `addLong` and `addSlice`.
```java
kafkaBuffers.addLong(startOffset);
kafkaBuffers.addSlice(byteBuf, OFFSET_LENGTH);
final var batchedByteBuf = kafkaBuffers.merge(); // the merged buffer
```
--
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@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org