Repository navigation
fix(binding-mqtt-kafka): discard the session offsets record at session expiry - #3184
Merged
jfallows merged 2 commits intoNov 13, 2026
Conversation
The expiry scenarios now expect a tombstone for <clientId>#offsets after the tombstone for the session record, including two scenarios that feed the expiry signal back through the signal stream with a zero delay and with the largest delay. A new scenario shows a Clean Start=1 connect replacing a stale <clientId>#offsets record. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXkbbzwjvWSZ2M9zor
…n expiry Session expiry now produces a tombstone for <clientId>#offsets together with the tombstone for the session record. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoXkbbzwjvWSZ2M9zor
jfallows
changed the base branch from
develop
to
fix/3172-mqtt-kafka-retained-filter-flags
November 13, 2026 01:57
jfallows
force-pushed
the
fix/3170-mqtt-kafka-discard-session-offsets
branch
from
November 13, 2026 01:59
861dd6f to
e82b3cf
Compare
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part of #3170. This PR covers the per-session
#offsetsrecord only; resetting the consumer-group offsets is the remaining work (see below).<clientId>#offsetsrecord, which holds the per-session QoS 2 packet ids and the producer state, survived, so a later connect with Clean Start=0 (or Clean Session=0) could restore stale inbound QoS 2 packet ids. Expiry now produces a tombstone for<clientId>#offsets(hash key<clientId>) right after the tombstone for the session record, built the same way as the existing session tombstone.#offsetsrecord with no packet ids is written. A new scenario shows this, passes on unchanged code, and is included as a regression guard.This PR is based on #3182's branch (
fix/3172-mqtt-kafka-retained-filter-flags), the top of the current stack (develop <- #3176 <- #3179 <- #3186 <- #3190 <- #3191 <- #3180 <- #3182). It will be retargeted todevelopafter the PRs below it merge.Part of #3170
MQTT specification statements this change serves
I read these sections in the full OASIS texts (MQTT 5.0 OS and MQTT 3.1.1 OS), downloaded and read as text, not through a summarising fetch:
What the text says, and how it maps to this change:
#offsetsrecord carries the last item: the inbound QoS 2 packet ids that have not been completely acknowledged.#offsetsrecord is not reused: the new session starts with a new producer and no packet ids.The specifications do not mention a per-session
#offsetsrecord: it is an implementation detail of how this binding stores part of the Session State. The change is anchored to the statements above about the State it holds, not to any wording about the record itself.Not covered by this PR, though it is part of the same Session State per the text above: the consumer-group offsets that hold the subscribe-side QoS 1 and 2 state (see Not delivered).
Test evidence
Test-first: the first commit holds the scripts and IT methods only; the second is the fix.
session.close.expire.session.state,session.abort.expire.session.state,session.expiry.after.signal.stream.restart,session.ignore.non.fetch.signal.stream.flush) now expect the<clientId>#offsetstombstone on both sides.session.close.expire.session.offsets.immediately(expiry 0, delay 0) andsession.close.expire.session.offsets.large.interval(expiry 3000000, delay 2147483647). The existing.immediatelyand.large.intervalscenarios could not cover this: their ITs run withWILL_AVAILABLE_NAME=false, so no signal stream is opened and expiry never fires. They are unchanged.session.clean.start.discard.offsets: a staleclient#offsetsrecord (packet ids 1 to 3, producer 12345) is served, Clean Start=1 connects, and the Kafka side must see a new producer and a fresh#offsetsrecord without packet ids.KafkaIT,MqttIT) and a binding IT inMqttKafkaSessionProxyIT.Against the unchanged production code on this base (the first commit on top of #3182's head),
MqttKafkaSessionProxyITfailed the four existing expiry scenarios and the two new ones, each because the#offsetstombstone never arrives. Zilla produced only the session tombstone (8-byte key,client-1); the zero-delay and large-interval paths do expire the session, they just never discarded the offsets record. Several of those failed on the retry run as well (timeouts).shouldDiscardOffsetsOnCleanStartpassed on unchanged code (it also passed on the earlier baseb1a53e98f), so no code change was needed for Clean Start. The spec peer-to-peerKafkaITandMqttITpass, so the scripts agree with each other.After the fix,
clean verifywith checkstyle and license checks on, build cache skipped, for both touched modules (upstream modules were installed beforehand with-am -Dskip.checks=true; a full-amrun with checks on stops in the unrelatedbuildmodule's notice check, which cannot find licenses formanagerandzpm-maven-pluginin this environment):specs/binding-mqtt-kafka.spec: 274 ITs (KafkaIT150,MqttIT124), 0 failures, plus 27 unit and schema testsruntime/binding-mqtt-kafka: 155 ITs (MqttKafkaSessionProxyIT41,MqttKafkaSubscribeProxyIT69,MqttKafkaPublishProxyIT45), 0 failures, plus 10 unit testsThe known intermittent
MqttKafkaSubscribeProxyIT.shouldReceiveServerSentRetainedReset(see #3161) did not occur in this run; I left its script alone.The rebase onto #3182 was conflict free. The stack below changes
MqttKafkaSessionFactoryonly in the publish-flush path (null guards onmetadata), which does not overlap the expiry signal handler changed here, and none of the scenario scripts touched here. Nothing was changed beyond the mechanical rebase except folding the two expiry scenarios into the tests-first commit.CI on the PR head
e82b3cf33d(base #3182's branch): 17 check runs completed, 16 success and 1 skipped ("Publish build cache", which only runs on develop pushes), including Build (25), CodeQL, Analyze (java) and themqtt.kafka.proxyandasyncapi.mqtt.kafka.proxyexample tests.Not delivered
<groupIdPrefix>-<clientId>): not reset at expiry or on Clean Start=1. The Clean Start part is in feat(binding-mqtt-kafka): delete the group offsets of the session on clean start #3202 (stacked on this PR); the expiry part is not built. mqtt-kafka: Clean Start and session expiry do not discard the per-session offsets #3170 stays open for it.Follow-ups
🤖 Generated with Claude Code
https://claude.ai/code/session_01SiHVoXkbbzwjvWSZ2M9zor