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

nats-io / nats-server / 30189872764
77%

Build:
DEFAULT BRANCH: main
Ran 26 Jul 2026 06:50AM UTC
Jobs 1
Files 67
Run time 1min
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

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

Coverage Regressions

Lines Coverage ∆ File
323
76.41
-11.28% src/github.com/nats-io/nats-server/server/leafnode.go
218
44.9
-18.37% src/github.com/nats-io/nats-server/server/websocket.go
67
78.74
-0.48% src/github.com/nats-io/nats-server/server/filestore.go
65
85.7
-2.01% src/github.com/nats-io/nats-server/server/server.go
54
51.67
-2.78% src/github.com/nats-io/nats-server/server/reload.go
43
88.88
-0.78% src/github.com/nats-io/nats-server/server/client.go
34
83.14
-0.1% src/github.com/nats-io/nats-server/server/jetstream_cluster.go
26
63.14
-0.2% src/github.com/nats-io/nats-server/server/opts.go
25
83.1
-1.96% src/github.com/nats-io/nats-server/server/auth.go
18
80.09
0.44% src/github.com/nats-io/nats-server/server/raft.go
15
74.16
-0.16% src/github.com/nats-io/nats-server/server/jetstream_api.go
12
70.26
-0.34% src/github.com/nats-io/nats-server/server/monitor.go
10
81.04
-0.94% src/github.com/nats-io/nats-server/server/parser.go
6
86.89
-0.09% src/github.com/nats-io/nats-server/server/accounts.go
6
82.55
-0.24% src/github.com/nats-io/nats-server/server/route.go
6
86.35
0.0% src/github.com/nats-io/nats-server/server/stream.go
5
85.18
0.05% src/github.com/nats-io/nats-server/server/events.go
5
72.04
-0.14% src/github.com/nats-io/nats-server/server/memstore.go
5
89.49
-0.42% src/github.com/nats-io/nats-server/server/sublist.go
4
74.87
-2.09% src/github.com/nats-io/nats-server/server/jwt.go
3
93.59
-0.12% src/github.com/nats-io/nats-server/server/gateway.go
2
82.14
-0.42% src/github.com/nats-io/nats-server/server/avl/seqset.go
Jobs
ID Job ID Ran Files Coverage
1 30189872764.1 26 Jul 2026 06:50AM UTC 67
76.55
GitHub Action Run
Source Files on build 30189872764
  • Tree
  • List 67
  • Changed 25
  • Source Changed 0
  • Coverage Changed 25
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #30189872764
  • 5e645df4 on github
  • Prev Build on main (#30145931992)
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