Repository navigation
v2.6.6
What's Changed
| PR | Title | Category |
|---|---|---|
| #174 | Fix Inflight resend deadlock, quota overshoot and resend ordering | fix (critical) |
| #172 | Config: merge environment variable overrides on top of YAML | feat |
| #173 | Fix routing table lost on raft snapshot restore | fix |
| #175 | Helm chart 0.5.0: extraEnv passthrough for COMQTT_* |
chore(helm) |
| #169 #170 | Fix ACL bypass via prefix topic matching (CVSS 4.3) | security |
| #171 | Fix raft log typos | chore |
Details
#174 fix: Inflight resend deadlock, quota overshoot and resend ordering
Three concurrency/correctness defects in mqtt/inflight.go, all found while load-testing many QoS 1 publishers against one slow subscriber.
- Deadlock (the serious one).
NextImmediate()tookRLockand then calledGetAll(), which tookRLockagain. Go'sRWMutexblocks new readers as soon as a writer is queued, so a publisher'sSetlanding between the two read locks left the goroutine holding the first lock forever.processPackethits that path on every packet when inflight is non-empty (server.go:714), so a single client could wedge permanently — no PUBACK processing, unbounded inflight growth, goroutine leak. Reproduced reliably before the fix; passes in ~0.2s after. - Quota overshoot. The helpers did load-then-add (
if Load() > 0 { Add(-1) }), which is not atomic. Concurrent publishers could push the send quota below zero or pastmaximumSendQuota, transiently over-running the client'sReceiveMaximum. Now CAS loops, so0 <= quota <= maxactually holds. - Resend ordering.
GetAllsorted byuint16(Created), butCreatedis an int64 unix timestamp. The truncation wraps every ~18 hours and scrambled resend order across the boundary. Now compares the int64s directly.
+138/−11 across mqtt/inflight.go and mqtt/inflight_test.go, with regression tests for all three.
#172 feat: environment variable overrides on top of YAML
config.Load now applies COMQTT_* environment variables on top of the YAML baseline, so operators can override scalar values at deploy time without rewriting the config file — e.g. injecting a dynamic Kubernetes pod IP into cluster.bind-addr with Hashicorp Raft. Refs #119.
- Naming rule:
COMQTT_+ the dotted yaml path, uppercased,-→_(e.g.mqtt.tcp→COMQTT_MQTT_TCP) - Structure-aware reflection walk; supports
string,int/uintandbool - Slices and maps (e.g.
cluster.members) are not overridable and keep their YAML value - An unset variable leaves the YAML value untouched; an empty string explicitly clears it
- Documented in the README under "Environment variable overrides"
+328/−3, with 13 test cases covering baseline-unchanged, override, supply-a-missing-value, empty-string-clearing, unset-leaves-untouched, and the #119 bind-addr scenario.
#173 fix: routing table lost on raft snapshot restore
Since d5c33e1, KV.GetAll() returns a copy — so both restore paths (hashicorp Fsm.Restore and etcd recoverFromSnapshot) were decoding snapshots into a throwaway map. A node that installed a snapshot ended up with an empty routing table: remote subscriptions stopped receiving forwarded publishes until they re-subscribed. Silent failure, high diagnostic cost.
Adds KV.Restore, which decodes into a fresh map and swaps it in under the lock, replacing prior state as raft snapshot semantics require. Covered by new tests for both backends, including a corrupt snapshot.
#175 chore(helm): extraEnv passthrough, chart 0.4.0 → 0.5.0
#172's env overrides were unreachable from Helm: the chart only injected its own seven hardcoded variables and exposed no way to pass anything else. Adds an extraEnv list rendered into the broker container in both single and cluster modes, appended after the chart's downward-API variables. Defaults to [], so existing releases render unchanged.
Also bumps appVersion 2.6.0 → 2.6.6. Chart version is independent of the broker version; this is the fourth chart release.
#169 #170 security: ACL bypass via prefix topic matching (CVSS 4.3)
Two separate authorisation defects in MatchTopic (mqtt/hooks/auth/ledger.go). Reported by Team Atlanta.
- Prefix bypass.
MatchTopicreturnedtrueafter exhausting filter parts without checking whether topic parts remained, so a literal ACL filter such asallowedalso matched publishes toallowed/secret. Matching now requireslen(topicParts) == len(filterParts). #wildcard non-compliance. The bounds check returnedfalsebefore testing whether the filter part was#, so the multi-level wildcard could not match zero sublevels as MQTT 4.7 requires. NowMatchTopic('a/#', 'a')istruewhileMatchTopic('a/+', 'a')staysfalse.
#171 chore: raft log typos
Eight message corrections in the etcd backend (dnapshot → snapshot, failed ti listen → failed to listen, listeing → listening, membe → member, snapshit → snapshot). Contributed by @mattfiocca.
⚠️ Action required: ACL rule behaviour change
The # zero-sublevel fix changes how existing ACL rules resolve. A rule written as sensors/# previously did not match the topic sensors; it now does.
If you rely on that distinction — for example a write-only rule devices/# that must not grant read on devices itself — review your rules and, where needed, split them into an exact rule plus a wildcard rule. Re-run your rule set through MatchTopic before upgrading if you are unsure.
Helm chart
| Version | Broker | Contents |
|---|---|---|
| 0.4.0 | 2.6.0–2.6.5 | OCI publishing to GHCR, Gateway API (HTTPRoute/TCPRoute) |
| 0.5.0 | 2.6.6 | Adds extraEnv passthrough for COMQTT_* overrides |
helm repo add comqtt oci://ghcr.io/wind-c/charts
helm upgrade --install comqtt comqtt/comqtt --version 0.5.0Note that image.tag falls back to Chart.appVersion, so upgrading the chart without pinning image.tag rolls pods onto the 2.6.6 image. Pin image.tag beforehand if you need to stage the rollout.
Contributors
Thanks to everyone who contributed to this release:
- @mattfiocca — raft log typo fixes (#171)
- @goingforstudying-ctrl — raft snapshot restore fix (#173), Inflight deadlock/quota/ordering fix (#174)
- @TeamAtlanta — reported the ACL bypass
Upgrade notes
- Binary and image users: pull
ghcr.io/wind-c/comqtt:2.6.6(or the floatingv2.6tag). - No config file schema changes; existing YAML keeps working as-is.
- Cluster operators on
>= 2.6.0should note the raft snapshot restore fix: nodes that have already restored a broken snapshot are still running with an empty routing table and will stay that way until they re-subscribe or restart with the new binary.
Full Changelog: v2.6.5...v2.6.6