GeezerVison is showing github.com — [Bug] Acknowledgements lost on bookies and brokers restart resulting in messages not being delivered · Issue #22709 · apache/pulsar
[Bug] Acknowledgements lost on bookies and brokers restart resulting in messages not being delivered #22709Labels type/bugThe PR fixed a bug or issue reported a bug DescriptionSearch before asking
- I searched in the issues and found nothing similar.
Read release policy
- I understand that unsupported versions don't get bug fixes. I will attempt to reproduce the issue on a supported version of Pulsar client and Pulsar broker.
Version
Client version: 3.2.2, Server version: 3.2.2
On previous version also notice same behaviour, e.g. 3.1.0, 3.1.2
Minimal reproduce step
Noticed messages loss when we restart all bookies and brokers during processing the data, so data is send to some topic and then our application consumes messages from topic saves msg payload somewhere and acknowledges messages. To be more precise here are steps:
- Simulate data streaming - send 1000000 msgs to topic A in some time, e.g. 1000000 msgs in 2 minutes.
- During the time when messages are sent restart all bookies and brokers at once (in our case we have 8 bookies and 6 brokers).
- In the same time application is consuming messages from topic A, saves message payload somewhere and after successful save acknowledges messages.
What did you expect to see?
No message loss
What did you see instead?
Some messages are lost. So when we send 1000000 messages, in directory where we store messages we see less than 1000000. We can't specify here how much less, because it is a very random situation. Sometimes we have all the messages, but sometimes something is missing.
Anything else?
No response
Are you willing to submit a PR?
- I'm willing to submit a PR!
Activitydao-jun commented on May 14, 2024 It looks a little strange, did you handle the send message result?
I mean, what do you do when send message failed?
It looks you don't handle the send message result, if there are some messages failed to send, you should handle the exception and retry again
In general, Pulsar do not retry to send message automatically, it's user's responsibility szkoludasebastian commented on May 15, 2024 I think it's not the case, because we are retrying. We handle message result and retry message if it was not sent correctly. During this test which I described we are sending messages till we won't have 1000000 correctly sent.
So we are sure that on input we have 1000000 messages. dao-jun commented on May 15, 2024 Did you mean you send 1000000 messages, the results are succeed, but after restart broker/bookie, some of them lost? szkoludasebastian commented on May 15, 2024 I mean we send 1000000 messages and during that time when our script was sending messages we restarted all bookies and brokers and then we were able to observe that some of messages lost. It was random situation for us, so we had to perform this test few times to observe that message loss. dao-jun commented on May 15, 2024 szkoludasebastian commented on May 15, 2024 I simplified our infrastructure a bit just to show our problem. To be more accurate our test script sends data to the application using websocket and our application sends messages to the topic. Our application responds with either ok or error results and in the case of error the script resends the message. In the case of the script and our application we see that as many messages as we expected were sent correctly. szkoludasebastian commented on May 15, 2024 We performed many failover tests using that script and we haven't observed any message loss. Only in this case when we restarted bookies and brokers in same time we observed something like that. lhotari commented on May 15, 2024
In the case of the script and our application we see that as many messages as we expected were sent correctly.
Which Pulsar client do you use? When you say "sent correctly", how do you define that? szkoludasebastian commented on May 15, 2024 We use pulsar client version: 3.2.2 (org.apache.pulsar:pulsar-client-api:3.2.2).
When I say that message was sent correctly I mean that we use something like this:
public CompletableFuture<Response> sendMessage(Request request) {
return producer.newMessage()
.value(request.getPayload())
.sendAsync()
.thenApply(messageId -> ok(request))
.exceptionallyCompose(ex -> createErrorResponse(request, ex));
}
so we are creating message based on websocket request, then we use sendAsync() and we use thenApply() to return ok response. When any exception appears then we use exceptionallyCompose() and we return error response. szkoludasebastian commented on May 15, 2024 Here is our configuration for pulsar client (in comments I put values):
public PulsarClient createPulsarClient(ClientBuilder pulsarClientBuilder, PulsarClientProperties properties) throws PulsarClientException {
return pulsarClientBuilder
.serviceUrl(properties.getProxyUrl()) //pulsar://localhost:6650
.ioThreads(properties.getHandlingBrokersConnectionThreads()) //10
.listenerThreads(properties.getListenerThreads()) //1
.connectionsPerBroker(properties.getMaxConnectionsPerBroker()) //10
.connectionTimeout(parseDurationToSeconds(properties.getConnectionTimeout()), TimeUnit.SECONDS) //PT30S
.operationTimeout(parseDurationToSeconds(properties.getOperationTimeout()), TimeUnit.SECONDS) //PT30S
.statsInterval(parseDurationToSeconds(properties.getStatsInterval()), TimeUnit.SECONDS)
.build();
}
and also configuration for producer:
public Producer<byte[]> createProducer(PulsarClient pulsarClient, PulsarProducerProperties properties) {
ProducerBuilder<byte[]> builder = pulsarClient.newProducer(Schema.BYTES);
return builder.topic(properties.getTopicPublish())
.batchingMaxPublishDelay(properties.getBatchingMaxPublishDelayMicros(), TimeUnit.MICROSECONDS) //100000
.batcherBuilder(BatcherBuilder.KEY_BASED)
.hashingScheme(HashingScheme.Murmur3_32Hash)
.blockIfQueueFull(true)
.sendTimeout(parseDurationToSeconds(properties.getSendTimeout()), TimeUnit.SECONDS) //PT30S
.create();
}
lhotari commented on May 15, 2024
so we are creating message based on websocket request, then we use sendAsync() and we use thenApply() to return ok response. When any exception appears then we use exceptionallyCompose() and we return error response.
@szkoludasebastian This looks correct. lhotari commented on May 15, 2024
Some messages are lost. So when we send 1000000 messages, in directory where we store messages we see less than 1000000. We can't specify here how much less, because it is a very random situation. Sometimes we have all the messages, but sometimes something is missing.
Another point of view is to say that the messages aren't delivered to the consumer in your test scenario. It's about the same as message loss from your application perspective, but there's a subtle difference. Would you be able to check if the messages are stored ok and would be available for delivery on another subscription and consumer that is started after this failure scenario. It's possible that the message loss happens in delivery on the consumer side.
What subscription type are you using? How do you handle acknowledgements?
When the problem happens, please share the internal stats for the topic and the subscription (use pulsar-admin topics stats-internal [topicname] to get it) immediately after the problem has happened. That would reveal useful information about the internal states. Please also provide topic stats ( pulsar-admin topics stats [topicname]), just to be sure that all available information is available for diagnostics. szkoludasebastian commented on May 15, 2024
- Here is consumer configuration:
public Consumer<byte[]> byteConsumer(ConsumerConfigurationProperties consumerConfigurationProperties) throws PulsarClientException {
return PulsarClient.builder()
.serviceUrl(consumerConfigurationProperties.getProxyUrl())
.statsInterval(consumerConfigurationProperties.getStatsInterval(), TimeUnit.SECONDS)
.build()
.newConsumer()
.subscriptionMode(SubscriptionMode.Durable)
.topic(consumerConfigurationProperties.getTopicSubscribeDecorated())
.subscriptionName(consumerConfigurationProperties.getSubscriptionName())
.consumerName(String.format("%s-%s", consumerConfigurationProperties.getConsumerName(), UUID.randomUUID()))
.subscriptionType(SubscriptionType.Key_Shared)
.keySharedPolicy(KeySharedPolicy.autoSplitHashRange())
.subscribe();
}
So we are using Key_Shared subscription.
- We are handling acknowledgments this way:
public void acknowledgeMessages(List<DomainMessageId> messages) {
List<MessageId> messageIds = messages.stream()
.map(this::toMessageId)
.toList();
consumer.acknowledgeAsync(messageIds)
.exceptionally(throwable -> {
log.error("ACKNOWLEDGE ERROR, messages Ids: {}", messageIds, throwable);
throw new IllegalStateException(throwable);
});
}
public void negativeAcknowledge(List<DomainMessageId> messages) {
messages.stream()
.map(this::toMessageId)
.forEach(consumer::negativeAcknowledge);
}
So we have these two methods. One for acknowledge messages and second one for negative ack. We consume messages from topic and store them in batches. When it's time to flush batch and it is correctly stored in directory which we want then we are using this method to acknowledge messages by id. When there is some error with storing data in desired directory then we negatively acknowledge messages.
- Here we have topics
partitioned-stats:
{
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesInCounter" : 0,
"msgInCounter" : 0,
"bytesOutCounter" : 8776881,
"msgOutCounter" : 13359,
"averageMsgSize" : 0.0,
"msgChunkPublished" : false,
"storageSize" : 262236942,
"backlogSize" : 0,
"publishRateLimitedTimes" : 0,
"earliestMsgPublishTimeInBacklogs" : 0,
"offloadedStorageSize" : 0,
"lastOffloadLedgerId" : 0,
"lastOffloadSuccessTimeStamp" : 0,
"lastOffloadFailureTimeStamp" : 0,
"ongoingTxnCount" : 0,
"abortedTxnCount" : 0,
"committedTxnCount" : 0,
"publishers" : [ {
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"averageMsgSize" : 0.0,
"chunkedMessageRate" : 0.0,
"producerId" : 0,
"supportsPartialProducer" : false
}, {
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"averageMsgSize" : 0.0,
"chunkedMessageRate" : 0.0,
"producerId" : 0,
"supportsPartialProducer" : false
} ],
"waitingPublishers" : 0,
"subscriptions" : {
"microbatcher" : {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 8776881,
"msgOutCounter" : 13359,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 222.64888172257446,
"chunkedMessageRate" : 0,
"msgBacklog" : 0,
"backlogSize" : 0,
"earliestMsgPublishTimeInBacklog" : 0,
"msgBacklogNoDelayed" : 0,
"blockedSubscriptionOnUnackedMsgs" : false,
"msgDelayed" : 0,
"unackedMessages" : 0,
"type" : "Key_Shared",
"msgRateExpired" : 0.0,
"totalMsgExpired" : 0,
"lastExpireTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastAckedTimestamp" : 0,
"lastMarkDeleteAdvancedTimestamp" : 0,
"consumers" : [ {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 4947858,
"msgOutCounter" : 7531,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 125.51649435506889,
"chunkedMessageRate" : 0.0,
"availablePermits" : 47969,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 3829023,
"msgOutCounter" : 5828,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 97.13238736750556,
"chunkedMessageRate" : 0.0,
"availablePermits" : 48422,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 50000,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 50000,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
} ],
"isDurable" : true,
"isReplicated" : false,
"allowOutOfOrderDelivery" : false,
"consumersAfterMarkDeletePosition" : { },
"nonContiguousDeletedMessagesRanges" : 0,
"nonContiguousDeletedMessagesRangesSerializedSize" : 0,
"delayedMessageIndexSizeInBytes" : 0,
"subscriptionProperties" : { },
"filterProcessedMsgCount" : 0,
"filterAcceptedMsgCount" : 0,
"filterRejectedMsgCount" : 0,
"filterRescheduledMsgCount" : 0,
"durable" : true,
"replicated" : false
}
},
"replication" : { },
"nonContiguousDeletedMessagesRanges" : 0,
"nonContiguousDeletedMessagesRangesSerializedSize" : 0,
"delayedMessageIndexSizeInBytes" : 0,
"compaction" : {
"lastCompactionRemovedEventCount" : 0,
"lastCompactionSucceedTimestamp" : 0,
"lastCompactionFailedTimestamp" : 0,
"lastCompactionDurationTimeInMills" : 0
},
"metadata" : {
"partitions" : 100,
"deleted" : false
},
"partitions" : { }
}
- Here we have topics
partitioned-stats-internal (attached as json file because there is a lot of lines):
partitioned-stats-internal.json
szkoludasebastian commented on May 15, 2024 I've added new subscription and consumer but there was no messages:
{
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesInCounter" : 0,
"msgInCounter" : 0,
"bytesOutCounter" : 8776881,
"msgOutCounter" : 13359,
"averageMsgSize" : 0.0,
"msgChunkPublished" : false,
"storageSize" : 262236942,
"backlogSize" : 0,
"publishRateLimitedTimes" : 0,
"earliestMsgPublishTimeInBacklogs" : 0,
"offloadedStorageSize" : 0,
"lastOffloadLedgerId" : 0,
"lastOffloadSuccessTimeStamp" : 0,
"lastOffloadFailureTimeStamp" : 0,
"ongoingTxnCount" : 0,
"abortedTxnCount" : 0,
"committedTxnCount" : 0,
"publishers" : [ {
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"averageMsgSize" : 0.0,
"chunkedMessageRate" : 0.0,
"producerId" : 0,
"supportsPartialProducer" : false
}, {
"msgRateIn" : 0.0,
"msgThroughputIn" : 0.0,
"averageMsgSize" : 0.0,
"chunkedMessageRate" : 0.0,
"producerId" : 0,
"supportsPartialProducer" : false
} ],
"waitingPublishers" : 0,
"subscriptions" : {
"message-loss-sub" : {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0,
"msgBacklog" : 0,
"backlogSize" : 0,
"earliestMsgPublishTimeInBacklog" : 0,
"msgBacklogNoDelayed" : 0,
"blockedSubscriptionOnUnackedMsgs" : false,
"msgDelayed" : 0,
"unackedMessages" : 0,
"type" : "Key_Shared",
"msgRateExpired" : 0.0,
"totalMsgExpired" : 0,
"lastExpireTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastAckedTimestamp" : 0,
"lastMarkDeleteAdvancedTimestamp" : 0,
"consumers" : [ {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 50000,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
} ],
"isDurable" : true,
"isReplicated" : false,
"allowOutOfOrderDelivery" : false,
"consumersAfterMarkDeletePosition" : { },
"nonContiguousDeletedMessagesRanges" : 0,
"nonContiguousDeletedMessagesRangesSerializedSize" : 0,
"delayedMessageIndexSizeInBytes" : 0,
"subscriptionProperties" : { },
"filterProcessedMsgCount" : 0,
"filterAcceptedMsgCount" : 0,
"filterRejectedMsgCount" : 0,
"filterRescheduledMsgCount" : 0,
"durable" : true,
"replicated" : false
},
"microbatcher" : {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 8776881,
"msgOutCounter" : 13359,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0,
"msgBacklog" : 0,
"backlogSize" : 0,
"earliestMsgPublishTimeInBacklog" : 0,
"msgBacklogNoDelayed" : 0,
"blockedSubscriptionOnUnackedMsgs" : false,
"msgDelayed" : 0,
"unackedMessages" : 0,
"type" : "Key_Shared",
"msgRateExpired" : 0.0,
"totalMsgExpired" : 0,
"lastExpireTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastAckedTimestamp" : 0,
"lastMarkDeleteAdvancedTimestamp" : 0,
"consumers" : [ {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 4947858,
"msgOutCounter" : 7531,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 47969,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 3829023,
"msgOutCounter" : 5828,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 48422,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 50000,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
}, {
"msgRateOut" : 0.0,
"msgThroughputOut" : 0.0,
"bytesOutCounter" : 0,
"msgOutCounter" : 0,
"msgRateRedeliver" : 0.0,
"messageAckRate" : 0.0,
"chunkedMessageRate" : 0.0,
"availablePermits" : 50000,
"unackedMessages" : 0,
"avgMessagesPerEntry" : 0,
"blockedConsumerOnUnackedMsgs" : false,
"readPositionWhenJoining" : "59360:3396",
"lastAckedTimestamp" : 0,
"lastConsumedTimestamp" : 0,
"lastConsumedFlowTimestamp" : 0,
"lastAckedTime" : "1970-01-01T00:00:00Z",
"lastConsumedTime" : "1970-01-01T00:00:00Z"
} ],
"isDurable" : true,
"isReplicated" : false,
"allowOutOfOrderDelivery" : false,
"consumersAfterMarkDeletePosition" : { },
"nonContiguousDeletedMessagesRanges" : 0,
"nonContiguousDeletedMessagesRangesSerializedSize" : 0,
"delayedMessageIndexSizeInBytes" : 0,
"subscriptionProperties" : { },
"filterProcessedMsgCount" : 0,
"filterAcceptedMsgCount" : 0,
"filterRejectedMsgCount" : 0,
"filterRescheduledMsgCount" : 0,
"durable" : true,
"replicated" : false
}
},
"replication" : { },
"nonContiguousDeletedMessagesRanges" : 0,
"nonContiguousDeletedMessagesRangesSerializedSize" : 0,
"delayedMessageIndexSizeInBytes" : 0,
"compaction" : {
"lastCompactionRemovedEventCount" : 0,
"lastCompactionSucceedTimestamp" : 0,
"lastCompactionFailedTimestamp" : 0,
"lastCompactionDurationTimeInMills" : 0
},
"metadata" : {
"partitions" : 100,
"deleted" : false
},
"partitions" : { }
}
lhotari commented on Aug 23, 2024
"consumersAfterMarkDeletePosition" : {
"microbatcher-consumer-d0850db4-7a7a-4795-9666-bc4230e9e1e6" : "125168:5",
"microbatcher-consumer-461783e3-e344-4bac-bb67-8c0922ee8d84" : "125168:5"
},
This is a sign that consuming is blocked, at least temporarily.The might be related to #21199 lhotari commented on Aug 23, 2024
"consumersAfterMarkDeletePosition" : {
"microbatcher-consumer-8b84fd23-9071-4cd2-83dc-d92478bf1ef0" : "199:2389",
"microbatcher-consumer-59971e53-578b-4a15-931f-dd6fb432b449" : "199:2389",
"microbatcher-consumer-dfa2669e-6142-480f-a98d-7076acd91628" : "199:2389"
},
Also here lhotari commented on Aug 23, 2024 lhotari commented on Sep 5, 2024
there are 868 messages unacknowledged. This is the last batch which should be flushed after 10 minutes. It should contain ~5000 msgs so ~4200 msgs are lost.
I'll rename the title from "Message loss" to "Acknowledgements lost". Technically the messages aren't lost, it's the acknowledgements that are lost. This can currently result in a situation where the messages don't get delivered to the client without reconnecting or unloading the topic. Reacted by szkoludasebastian changed the title [-][Bug] Message loss on bookies and brokers restart[/-] [+][Bug] Acknowledgements lost on bookies and brokers restart resulting in messages not being delivered[/+] on Sep 5, 2024lhotari commented on Sep 7, 2024 Analysis:
Acknowledgements will get lost in broker restarts. That's part of current design. That will cause Key_Shared consumers to "get stuck" and the messages aren't delivered (not technically lost).
I'm working on a solution to this problem based on the "ack receipt" feature. That has gaps. One of them is #23261 . In addition to that a new mode is needed where acknowledgements get automatically retried.
For detecting application side issues there is #23262 .
The current ack receipt documentation is confusing and wrong, there's #23249 for handling that.
In addition to addressing the lost acks issue, there's also a need for PIP-282 changes #21953 and other PRs #23226 (merged) and #23231 (in-progress).
There are multiple improvements in progress to cover fix this issue. lhotari commented on Sep 7, 2024 szkoludasebastian commented on Sep 9, 2024 Thank you for your commitment to analyze this problem. Do you perhaps know when these fixes and proposed change will be available for testing? lhotari commented on Sep 9, 2024
Thank you for your commitment to analyze this problem. Do you perhaps know when these fixes and proposed change will be available for testing?
There's no published timeline yet. Since there are multiple related issues, I'm planning to create a GitHub project which will make it easier to follow the progress of individual issues.
It's possible that PIP-377 solution isn't required eventually since there could be a way to make improvements so that Key_shared subscriptions wouldn't end up losing acknowledgements during bookie and broker restarts.
Individual reproducer applications or instructions would be useful since they could help validate the solutions along the way.
@szkoludasebastian Contributing a way to reproduce the issues with the given instructions consistently would be a very valuable contribution to this work. Have you had a chance to make progress on that front? szkoludasebastian commented on Sep 10, 2024 Unfortunately not much progress in this area. I will inform here about the progress dominikkulik commented on Oct 21, 2024 Hi @lhotari
Some time ago we proceeded to create an application that will allow us to reproduce this error. However, it turned out that we are not able to do this.
After thorough analysis, we determined that the problem was in our service. Our deduplication mechanism was not properly implemented, which led to a situation that messages which should not have been acked, were acked after restarting our service. The problem was in our cache implementation.
Multiple attempts to restart bookies and brokers by themselves further confirmed that no message was lost.
Thank you for your commitment and help. Ticket can be closed. lhotari commented on Oct 21, 2024
Hi @lhotari
Some time ago we proceeded to create an application that will allow us to reproduce this error. However, it turned out that we are not able to do this.
After thorough analysis, we determined that the problem was in our service. Our deduplication mechanism was not properly implemented, which led to a situation that messages which should not have been acked, were acked after restarting our service. The problem was in our cache implementation.
Multiple attempts to restart bookies and brokers by themselves further confirmed that no message was lost.
Thank you for your commitment and help. Ticket can be closed.
Thanks for confirming, @dominikkulik . I'll close this issue.
MetadataMetadatatype/bugThe PR fixed a bug or issue reported a bug StatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|