• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server
77%

Build:
DEFAULT BRANCH: main
Repo Added 06 May 2019 06:55PM UTC
Files 67
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH main
branch: SELECT
CHANGE BRANCH
x
  • No branch selected
  • change_nightly_from_main_to_dev
  • fix_code_coverage
  • fix_flappers_update_cov_go
  • main

24 Jul 2026 09:07AM UTC coverage: 76.546% (-0.9%) from 77.402%
30189872764

push

github

web-flow
[FIXED] MQTT: QoS2 message released on a resumed session lost its QoS and PI (#8414)

This came up while testing with
https://github.com/ConnectEverything/mqtt-test/pull/4

Two root causes. The delivery callbacks and the retain handling read the
publishing connection's c.mqtt.pp — the last PUBLISH parsed — which is
stale for a PUBREL- or will-initiated delivery, so a QoS2 message
released after a reconnect was delivered as QoS0 with no packet
identifier. And the staged copy in $MQTT_qos2in never persisted the
retain flag, so it could not be recovered on another connection at all.
Same-connection flows worked only while the scratch happened to still
hold the right packet. Because of the interplay, the two must be fixed
together.

The delivered message now becomes the client's current publish for the
duration of the broadcast (swapped into the readLoop-owned c.mqtt.pp,
restored by the same defer as the pubargs); wills build their own
mqttPublish and use the common path instead of writing into the scratch
by hand. The staged copy
persists the retain flag in a second, flags byte of the Nmqtt-Pub header
value, restored when the PUBREL rebuilds the publish; older servers read
only the first (QoS) byte, and messages without a flags byte read as not
retained.

Retained QoS2 messages now survive an in-flight reconnect: a PUBLISH
staged on one connection and released by the PUBREL on the next stores
the retained message, where before the retain bit died with the first
connection's parser state. This matches Spec [MQTT-4.3.3] Method A as
implemented by mosquitto, which likewise persists the retain flag with
the staged message and applies it at release, together with the
delivery.

Added regression tests: a PUBREL on a resumed session delivers at the
subscription's QoS exactly once, a retransmitted PUBREL is acknowledged
without redelivering, and the retain flag survives the staging round
trip.

72417 of 94606 relevant lines covered (76.55%)

491309.4 hits per line

Relevant lines Covered
Build:
Build:
94606 RELEVANT LINES 72417 COVERED LINES
491309.4 HITS PER LINE
Source Files on main
  • Tree
  • List 67
  • Changed 25
  • Source Changed 0
  • Coverage Changed 25
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
30189872764 main [FIXED] MQTT: QoS2 message released on a resumed session lost its QoS and PI (#8414) This came up while testing with https://github.com/ConnectEverything/mqtt-test/pull/4 Two root causes. The delivery callbacks and the retain handling read the p... push 26 Jul 2026 06:50AM UTC web-flow github
76.55
30145931992 main [FIXED] MQTT: QoS2 message released on a resumed session lost its QoS and PI (#8414) This came up while testing with https://github.com/ConnectEverything/mqtt-test/pull/4 Two root causes. The delivery callbacks and the retain handling read the p... push 25 Jul 2026 06:38AM UTC web-flow github
77.4
30069887114 main [FIXED] Clustered consumer create races stream meta apply (#8410) A stream create immediately followed by a consumer create could fail with a `stream not found`. This can happen if the stream leader applies and answers the stream creation faster ... push 24 Jul 2026 06:42AM UTC web-flow github
77.49
29982745260 main [Fixes] 8396 - Consumer reset across account barriers (#8407) ### Problem Consumer RESET responses sent through a service import could be dropped. The service-import response subscription and the response publisher share the exporting account's ... push 23 Jul 2026 06:45AM UTC web-flow github
76.57
29894217393 main [IMPROVED] Recycle msg block buffer on weak cache GC (#8395) Follow-up of https://github.com/nats-io/nats-server/pull/8380. In `firstSeqForSubj` and `recalculateForSubj` the weak cache would be loaded as a side-effect of `if mb.cacheNotLoaded()`... push 22 Jul 2026 06:41AM UTC web-flow github
76.65
29804479395 main De-flake TestJetStreamClusterOfflineStreamAndConsumerAfterDowngrade (#8390) push 21 Jul 2026 06:42AM UTC web-flow github
76.55
29720040716 main De-flake TestJetStreamClusterOfflineStreamAndConsumerAfterDowngrade (#8390) push 20 Jul 2026 06:55AM UTC web-flow github
77.75
29675132011 main De-flake TestJetStreamClusterOfflineStreamAndConsumerAfterDowngrade (#8390) push 19 Jul 2026 06:43AM UTC web-flow github
73.44
29632336646 main De-flake TestJetStreamClusterOfflineStreamAndConsumerAfterDowngrade (#8390) push 18 Jul 2026 06:35AM UTC web-flow github
81.43
29557543789 main De-flake TestJetStreamClusterOfflineStreamAndConsumerAfterDowngrade (#8390) push 17 Jul 2026 06:37AM UTC web-flow github
72.72
See All Builds (6201)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc