Update module github.com/wind-c/comqtt/v2 to v2.6.7 #95

Merged
renovate_bot merged 1 commit from renovate/github.com-wind-c-comqtt-v2-2.x into master 2026-10-26 21:13:44 +00:00
renovate_bot commented 2026-10-16 22:12:27 +00:00 (Migrated from jonasled.dev)

This MR contains the following updates:

Package Change Age Confidence
github.com/wind-c/comqtt/v2 v2.6.5 → v2.6.7 age confidence

Release Notes

wind-c/comqtt (github.com/wind-c/comqtt/v2)

v2.6.7

Compare Source

What's Changed

MR Title Category
#​183 Grow packet buffers as data arrives instead of pre-allocating fix (critical)
#​181 A partial capabilities block no longer zeroes every default fix (critical)
#​180 Bound repeated MQTT v5 property counts fix (security)
#​182 Cap topic filter depth to stop trie memory amplification fix (security)
#​186 Retry transient Accept errors instead of silently killing a listener fix
#​191 Drop a relayed publish whose declared body is longer than its payload fix
#​184 Break inflight resend order ties so persistent sessions resend in order fix
#​185 Make same-id session takeover atomic fix
#​187 Explain accept queue limits and reconnect bursts docs
#​189 Wait for writes to land instead of sleeping before closing test
#​190 Strengthen the publish assertions so a broken write is caught test
Details

#​183 fix: grow packet buffers as data arrives instead of pre-allocating

A packet body's size comes from a Remaining Length the peer declares in the fixed header, before a single body byte has arrived. ReadPacket allocated that much up front and then blocked on the read. An unauthenticated peer could declare the protocol maximum of 256 MB, send five bytes, and go quiet, and the broker would hold that much memory for as long as the socket stayed open.

The MaximumPacketSize check could not stop it: it is keyed off the same declared value, the shipped default is 0 ("unlimited"), and ReadFixedHeader skips the check entirely when it is 0. No read deadline is in effect while the CONNECT packet itself is being read either, so nothing else would have timed the connection out.

Bodies over 64 KiB are now grown geometrically as data actually arrives, so broker memory tracks bytes received rather than bytes declared. Bodies up to 64 KiB keep the previous single-allocation path, byte for byte.

Measured on this tree (Windows, Go 1.26, unauthenticated MQTT 5, one connection per 256 MB declaration, process working set):

              before                     after
conn   1:   258.6 MiB                  0.3 MiB
conn   8: 2,054.8 MiB (256.9/conn)     6.6 MiB (0.83/conn)
conn  24: 6,160.8 MiB (256.7/conn)    14.3 MiB (0.59/conn)
conn  40: 10,264.4 MiB (256.6/conn)   16.2 MiB (0.41/conn)

Flat, and still flat when the connections are held open. A peer that declares a large body and then sends nothing still reserves 64 KiB while it waits, which is the same order as the goroutine and socket the connection already costs.

The read error semantics now match io.ReadFull exactly, including the case where a read delivers the final bytes together with io.EOF. That case is reachable in production: crypto/tls returns (n, io.EOF) from a single Read when a close_notify arrives behind the last data.

The same change also fixes a leaked registration: a client that could not receive its CONNACK stayed in the client registry forever, holding its buffer and its connection.

+362/−10 across mqtt/clients.go, mqtt/server.go and the tests, including an equivalence test that pins the new read path to the behaviour of the io.ReadFull it replaced, and a test that proves the growth path consumes exactly the declared body and no more.

#​181 fix: a partial capabilities block no longer zeroes every default

The presence of any capabilities: key in the config made YAML allocate a zero-valued struct, so Capabilities stopped being nil and New() skipped DefaultServerCapabilities entirely. Declaring a single key then silently zeroed every other capability.

The worst of them was MaximumMessageExpiryInterval: at zero, the once-per-second expiry sweep matched every queued message as expired, so the entire offline queue was discarded and persistent sessions stopped delivering, with nothing logged.

Capabilities.UnmarshalYAML now decodes on top of the defaults, merging per key rather than per field, so a partial block keeps the defaults for the keys it omits while explicit zeros (maximum-packet-size: 0, meaning unlimited) still work.

This is a behaviour change for anyone who relied on a partial block zeroing the other capabilities. If you wanted a capability off, set it explicitly.

+188/−9 across mqtt/server.go and the tests.

#​180 fix: bound repeated MQTT v5 property counts

MQTT v5 puts no count limit on repeated User Property or Subscription Identifier entries, and neither has a count limit in the specification. Left unbounded, a single packet amplifies badly: Properties.User is a slice of 32-byte entries, so a 10 MB property section carrying two-byte properties grew to about 46 MB of slice, and Properties.Copy duplicated all of it again on top of the packet buffers. One unauthenticated CONNECT could push a broker's RSS up by two orders of magnitude.

Both are now capped: 128 User Properties and 1024 Subscription Identifiers per packet. The subscription identifier limit is deliberately much higher, because MQTT v5 permits one identifier per filter in a SUBSCRIBE and a conforming client needs as many as it has filters.

+150/−2 across mqtt/packets/, with tests for both limits.

#​182 fix: cap topic filter depth to stop trie memory amplification

A retained message allocated one trie node per / separated topic level, so a deeply nested topic name could be amplified into a large structure from a single message. The depth is now capped, and a filter that exceeds it is rejected rather than truncated, because a truncated filter no longer matches what the client asked for. [MQTT-4.7.3-1]

+342 across mqtt/server.go, mqtt/topics.go and the tests.

#​186 fix: retry transient Accept errors instead of silently killing a listener

Listeners.Serve calls a listener's Serve exactly once, with nothing to restart it, so returning on a transient accept failure took the listener down for good, and nothing was logged. The OS listening socket stays open, so clients kept completing the TCP handshake and then hung until their own timeout, each occupying an accept queue slot.

Accept now retries with a capped backoff. The most common causes were EMFILE when a burst of connections exhausted the file descriptor table, and ECONNABORTED when a peer disappeared mid-handshake. The retry is bounded and the listener is only torn down when it is actually closed.

+461/−33 across mqtt/listeners/, with a test that a client is served normally after a transient accept error.

#​191 fix: drop a relayed publish whose declared body is longer than its payload

A cluster peer chooses the bytes in a relayed publish, including the remaining length it declares. An empty payload made readFixedHeader read b[0], and a payload shorter than the body it declared made the offset negative and the slice out of range. Both panicked inside the relay worker.

The relay now drops a payload it cannot unpack. A malformed relay was already dropped silently when the fixed header could not be decoded, so this keeps the same behaviour and does not add a log line that a hostile peer could use to flood the log.

Note that the gRPC channel between nodes is unauthenticated and unencrypted. That is a separate and larger question, and this change only makes the relay resilient to malformed input.

+105 across cluster/agent.go and the tests.

#​184 fix: break inflight resend order ties so persistent sessions resend in order

Created is a unixtime with one-second resolution, so messages published within the same second tie. sort.Slice is unstable and the slice came out of a map with randomised iteration order, so tied messages were left in an arbitrary order that changed on every call, and resends of a persistent session could go out rotated rather than in their original order. [MQTT-4.6.0-1]

Packet ids are handed out in ascending order, are unique, and are preserved across resend and session restore, so they make this a strict total order.

+181/−1 across mqtt/inflight.go and the tests.

#​185 fix: make same-id session takeover atomic

Two connections with the same client id could each believe it had won the takeover. The registry now removes the displaced client with a compare-and-delete, so a stale cleanup cannot drop a newer connection with the same id.

+154/−2 across mqtt/clients.go, mqtt/server.go and the tests.

#​187 docs: explain accept queue limits and reconnect bursts

A listening TCP socket holds only a limited number of connections that completed the handshake but were not handed to the process. The depth is a system setting, and comqtt does not override it. The README now covers it, with the somaxconn settings for Linux and macOS, and why clients should reconnect with exponential backoff plus jitter.

+35 in README.md.

#​189 and #​190 test: make the publish tests deterministic

Twelve tests closed the client connection a fixed time after publishing and then asserted on the bytes that arrived, so they passed or failed depending on how quickly the write loop drained the outbound queue. They now wait for the writes to complete, which is a delivery signal rather than a timing guess: a write to a pipe completes only once the reader has taken the bytes.

Three of them had assertions too weak to notice a broken write, and one of them had lost a length check that was implicit in the original. A test that compared the message expiry interval also failed about once in 20000 runs, because the interval is derived from the time the publish was created and the clock can tick between the two readings.

The whole mqtt package now passes 50 consecutive runs under -race with no failures.

Upgrade notes

No configuration change is required. maximum-packet-size is still 0 by default, which means unlimited, and the packet buffer no longer follows the declared length.

Two behaviour changes are worth knowing about:

  • A partial capabilities: block now merges on top of the defaults instead of zeroing them. If you wanted a capability disabled, set it explicitly.
  • A packet carrying more than 128 User Properties or more than 1024 Subscription Identifiers is rejected. Both limits are far above what conforming clients send.
Thank you

Thanks to everyone who reported an issue or reviewed a change in this cycle.

v2.6.6

Compare Source

What's Changed

MR 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() took RLock and then called GetAll(), which took RLock again. Go's RWMutex blocks new readers as soon as a writer is queued, so a publisher's Set landing between the two read locks left the goroutine holding the first lock forever. processPacket hits 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 past maximumSendQuota, transiently over-running the client's ReceiveMaximum. Now CAS loops, so 0 <= quota <= max actually holds.
  • Resend ordering. GetAll sorted by uint16(Created), but Created is 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/uint and bool
  • 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. MatchTopic returned true after exhausting filter parts without checking whether topic parts remained, so a literal ACL filter such as allowed also matched publishes to allowed/secret. Matching now requires len(topicParts) == len(filterParts).
  • # wildcard non-compliance. The bounds check returned false before testing whether the filter part was #, so the multi-level wildcard could not match zero sublevels as MQTT 4.7 requires. Now MatchTopic('a/#', 'a') is true while MatchTopic('a/+', 'a') stays false.

#​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.0

Note 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:

Upgrade notes
  • Binary and image users: pull ghcr.io/wind-c/comqtt:2.6.6 (or the floating v2.6 tag).
  • No config file schema changes; existing YAML keeps working as-is.
  • Cluster operators on >= 2.6.0 should 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: https://github.com/wind-c/comqtt/compare/v2.6.5...v2.6.6


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

♻ Rebasing: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this MR and you won't be reminded about this update again.


  • If you want to rebase/retry this MR, check this box

This MR has been generated by Mend Renovate CLI.

This MR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [github.com/wind-c/comqtt/v2](https://github.com/wind-c/comqtt) | `v2.6.5` → `v2.6.7` | ![age](https://developer.mend.io/api/mc/badges/age/go/github.com%2fwind-c%2fcomqtt%2fv2/v2.6.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/go/github.com%2fwind-c%2fcomqtt%2fv2/v2.6.5/v2.6.7?slim=true) | --- ### Release Notes <details> <summary>wind-c/comqtt (github.com/wind-c/comqtt/v2)</summary> ### [`v2.6.7`](https://github.com/wind-c/comqtt/releases/tag/v2.6.7) [Compare Source](https://github.com/wind-c/comqtt/compare/v2.6.6...v2.6.7) #### What's Changed | MR | Title | Category | | --------------------------------------------------- | ----------------------------------------------------------------------- | -------------- | | [#&#8203;183](https://github.com/wind-c/comqtt/issues/183) | Grow packet buffers as data arrives instead of pre-allocating | fix (critical) | | [#&#8203;181](https://github.com/wind-c/comqtt/issues/181) | A partial capabilities block no longer zeroes every default | fix (critical) | | [#&#8203;180](https://github.com/wind-c/comqtt/issues/180) | Bound repeated MQTT v5 property counts | fix (security) | | [#&#8203;182](https://github.com/wind-c/comqtt/issues/182) | Cap topic filter depth to stop trie memory amplification | fix (security) | | [#&#8203;186](https://github.com/wind-c/comqtt/issues/186) | Retry transient Accept errors instead of silently killing a listener | fix | | [#&#8203;191](https://github.com/wind-c/comqtt/issues/191) | Drop a relayed publish whose declared body is longer than its payload | fix | | [#&#8203;184](https://github.com/wind-c/comqtt/issues/184) | Break inflight resend order ties so persistent sessions resend in order | fix | | [#&#8203;185](https://github.com/wind-c/comqtt/issues/185) | Make same-id session takeover atomic | fix | | [#&#8203;187](https://github.com/wind-c/comqtt/issues/187) | Explain accept queue limits and reconnect bursts | docs | | [#&#8203;189](https://github.com/wind-c/comqtt/issues/189) | Wait for writes to land instead of sleeping before closing | test | | [#&#8203;190](https://github.com/wind-c/comqtt/issues/190) | Strengthen the publish assertions so a broken write is caught | test | ##### Details **[#&#8203;183](https://github.com/wind-c/comqtt/issues/183) fix: grow packet buffers as data arrives instead of pre-allocating** A packet body's size comes from a `Remaining Length` the peer declares in the fixed header, before a single body byte has arrived. `ReadPacket` allocated that much up front and then blocked on the read. An unauthenticated peer could declare the protocol maximum of 256 MB, send five bytes, and go quiet, and the broker would hold that much memory for as long as the socket stayed open. The `MaximumPacketSize` check could not stop it: it is keyed off the same declared value, the shipped default is `0` ("unlimited"), and `ReadFixedHeader` skips the check entirely when it is `0`. No read deadline is in effect while the CONNECT packet itself is being read either, so nothing else would have timed the connection out. Bodies over 64 KiB are now grown geometrically as data actually arrives, so broker memory tracks bytes received rather than bytes declared. Bodies up to 64 KiB keep the previous single-allocation path, byte for byte. Measured on this tree (Windows, Go 1.26, unauthenticated MQTT 5, one connection per 256 MB declaration, process working set): ``` before after conn 1: 258.6 MiB 0.3 MiB conn 8: 2,054.8 MiB (256.9/conn) 6.6 MiB (0.83/conn) conn 24: 6,160.8 MiB (256.7/conn) 14.3 MiB (0.59/conn) conn 40: 10,264.4 MiB (256.6/conn) 16.2 MiB (0.41/conn) ``` Flat, and still flat when the connections are held open. A peer that declares a large body and then sends nothing still reserves 64 KiB while it waits, which is the same order as the goroutine and socket the connection already costs. The read error semantics now match `io.ReadFull` exactly, including the case where a read delivers the final bytes together with `io.EOF`. That case is reachable in production: `crypto/tls` returns `(n, io.EOF)` from a single `Read` when a close\_notify arrives behind the last data. The same change also fixes a leaked registration: a client that could not receive its CONNACK stayed in the client registry forever, holding its buffer and its connection. +362/−10 across `mqtt/clients.go`, `mqtt/server.go` and the tests, including an equivalence test that pins the new read path to the behaviour of the `io.ReadFull` it replaced, and a test that proves the growth path consumes exactly the declared body and no more. **[#&#8203;181](https://github.com/wind-c/comqtt/issues/181) fix: a partial capabilities block no longer zeroes every default** The presence of any `capabilities:` key in the config made YAML allocate a zero-valued struct, so `Capabilities` stopped being nil and `New()` skipped `DefaultServerCapabilities` entirely. Declaring a single key then silently zeroed every other capability. The worst of them was `MaximumMessageExpiryInterval`: at zero, the once-per-second expiry sweep matched every queued message as expired, so the entire offline queue was discarded and persistent sessions stopped delivering, with nothing logged. `Capabilities.UnmarshalYAML` now decodes on top of the defaults, merging per key rather than per field, so a partial block keeps the defaults for the keys it omits while explicit zeros (`maximum-packet-size: 0`, meaning unlimited) still work. This is a behaviour change for anyone who relied on a partial block zeroing the other capabilities. If you wanted a capability off, set it explicitly. +188/−9 across `mqtt/server.go` and the tests. **[#&#8203;180](https://github.com/wind-c/comqtt/issues/180) fix: bound repeated MQTT v5 property counts** MQTT v5 puts no count limit on repeated User Property or Subscription Identifier entries, and neither has a count limit in the specification. Left unbounded, a single packet amplifies badly: `Properties.User` is a slice of 32-byte entries, so a 10 MB property section carrying two-byte properties grew to about 46 MB of slice, and `Properties.Copy` duplicated all of it again on top of the packet buffers. One unauthenticated CONNECT could push a broker's RSS up by two orders of magnitude. Both are now capped: 128 User Properties and 1024 Subscription Identifiers per packet. The subscription identifier limit is deliberately much higher, because MQTT v5 permits one identifier per filter in a SUBSCRIBE and a conforming client needs as many as it has filters. +150/−2 across `mqtt/packets/`, with tests for both limits. **[#&#8203;182](https://github.com/wind-c/comqtt/issues/182) fix: cap topic filter depth to stop trie memory amplification** A retained message allocated one trie node per `/` separated topic level, so a deeply nested topic name could be amplified into a large structure from a single message. The depth is now capped, and a filter that exceeds it is rejected rather than truncated, because a truncated filter no longer matches what the client asked for. \[MQTT-4.7.3-1] +342 across `mqtt/server.go`, `mqtt/topics.go` and the tests. **[#&#8203;186](https://github.com/wind-c/comqtt/issues/186) fix: retry transient Accept errors instead of silently killing a listener** `Listeners.Serve` calls a listener's `Serve` exactly once, with nothing to restart it, so returning on a transient accept failure took the listener down for good, and nothing was logged. The OS listening socket stays open, so clients kept completing the TCP handshake and then hung until their own timeout, each occupying an accept queue slot. Accept now retries with a capped backoff. The most common causes were EMFILE when a burst of connections exhausted the file descriptor table, and ECONNABORTED when a peer disappeared mid-handshake. The retry is bounded and the listener is only torn down when it is actually closed. +461/−33 across `mqtt/listeners/`, with a test that a client is served normally after a transient accept error. **[#&#8203;191](https://github.com/wind-c/comqtt/issues/191) fix: drop a relayed publish whose declared body is longer than its payload** A cluster peer chooses the bytes in a relayed publish, including the remaining length it declares. An empty payload made `readFixedHeader` read `b[0]`, and a payload shorter than the body it declared made the offset negative and the slice out of range. Both panicked inside the relay worker. The relay now drops a payload it cannot unpack. A malformed relay was already dropped silently when the fixed header could not be decoded, so this keeps the same behaviour and does not add a log line that a hostile peer could use to flood the log. Note that the gRPC channel between nodes is unauthenticated and unencrypted. That is a separate and larger question, and this change only makes the relay resilient to malformed input. +105 across `cluster/agent.go` and the tests. **[#&#8203;184](https://github.com/wind-c/comqtt/issues/184) fix: break inflight resend order ties so persistent sessions resend in order** `Created` is a unixtime with one-second resolution, so messages published within the same second tie. `sort.Slice` is unstable and the slice came out of a map with randomised iteration order, so tied messages were left in an arbitrary order that changed on every call, and resends of a persistent session could go out rotated rather than in their original order. \[MQTT-4.6.0-1] Packet ids are handed out in ascending order, are unique, and are preserved across resend and session restore, so they make this a strict total order. +181/−1 across `mqtt/inflight.go` and the tests. **[#&#8203;185](https://github.com/wind-c/comqtt/issues/185) fix: make same-id session takeover atomic** Two connections with the same client id could each believe it had won the takeover. The registry now removes the displaced client with a compare-and-delete, so a stale cleanup cannot drop a newer connection with the same id. +154/−2 across `mqtt/clients.go`, `mqtt/server.go` and the tests. **[#&#8203;187](https://github.com/wind-c/comqtt/issues/187) docs: explain accept queue limits and reconnect bursts** A listening TCP socket holds only a limited number of connections that completed the handshake but were not handed to the process. The depth is a system setting, and comqtt does not override it. The README now covers it, with the `somaxconn` settings for Linux and macOS, and why clients should reconnect with exponential backoff plus jitter. +35 in `README.md`. **[#&#8203;189](https://github.com/wind-c/comqtt/issues/189) and [#&#8203;190](https://github.com/wind-c/comqtt/issues/190) test: make the publish tests deterministic** Twelve tests closed the client connection a fixed time after publishing and then asserted on the bytes that arrived, so they passed or failed depending on how quickly the write loop drained the outbound queue. They now wait for the writes to complete, which is a delivery signal rather than a timing guess: a write to a pipe completes only once the reader has taken the bytes. Three of them had assertions too weak to notice a broken write, and one of them had lost a length check that was implicit in the original. A test that compared the message expiry interval also failed about once in 20000 runs, because the interval is derived from the time the publish was created and the clock can tick between the two readings. The whole `mqtt` package now passes 50 consecutive runs under `-race` with no failures. ##### Upgrade notes No configuration change is required. `maximum-packet-size` is still `0` by default, which means unlimited, and the packet buffer no longer follows the declared length. Two behaviour changes are worth knowing about: - A partial `capabilities:` block now merges on top of the defaults instead of zeroing them. If you wanted a capability disabled, set it explicitly. - A packet carrying more than 128 User Properties or more than 1024 Subscription Identifiers is rejected. Both limits are far above what conforming clients send. ##### Thank you Thanks to everyone who reported an issue or reviewed a change in this cycle. ### [`v2.6.6`](https://github.com/wind-c/comqtt/releases/tag/v2.6.6) [Compare Source](https://github.com/wind-c/comqtt/compare/v2.6.5...v2.6.6) #### What's Changed | MR | Title | Category | | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | -------------- | | [#&#8203;174](https://github.com/wind-c/comqtt/issues/174) | Fix Inflight resend deadlock, quota overshoot and resend ordering | fix (critical) | | [#&#8203;172](https://github.com/wind-c/comqtt/issues/172) | Config: merge environment variable overrides on top of YAML | feat | | [#&#8203;173](https://github.com/wind-c/comqtt/issues/173) | Fix routing table lost on raft snapshot restore | fix | | [#&#8203;175](https://github.com/wind-c/comqtt/issues/175) | Helm chart 0.5.0: `extraEnv` passthrough for `COMQTT_*` | chore(helm) | | [#&#8203;169](https://github.com/wind-c/comqtt/issues/169) [#&#8203;170](https://github.com/wind-c/comqtt/issues/170) | Fix ACL bypass via prefix topic matching (CVSS 4.3) | security | | [#&#8203;171](https://github.com/wind-c/comqtt/issues/171) | Fix raft log typos | chore | ##### Details **[#&#8203;174](https://github.com/wind-c/comqtt/issues/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()` took `RLock` and then called `GetAll()`, which took `RLock` again. Go's `RWMutex` blocks new readers as soon as a writer is queued, so a publisher's `Set` landing between the two read locks left the goroutine holding the first lock forever. `processPacket` hits 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 past `maximumSendQuota`, transiently over-running the client's `ReceiveMaximum`. Now CAS loops, so `0 <= quota <= max` actually holds. - **Resend ordering.** `GetAll` sorted by `uint16(Created)`, but `Created` is 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. **[#&#8203;172](https://github.com/wind-c/comqtt/issues/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 [#&#8203;119](https://github.com/wind-c/comqtt/issues/119). - Naming rule: `COMQTT_` + the dotted yaml path, uppercased, `-` → `_` (e.g. `mqtt.tcp` → `COMQTT_MQTT_TCP`) - Structure-aware reflection walk; supports `string`, `int`/`uint` and `bool` - 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 [#&#8203;119](https://github.com/wind-c/comqtt/issues/119) bind-addr scenario. **[#&#8203;173](https://github.com/wind-c/comqtt/issues/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. **[#&#8203;175](https://github.com/wind-c/comqtt/issues/175) chore(helm): `extraEnv` passthrough, chart 0.4.0 → 0.5.0** [#&#8203;172](https://github.com/wind-c/comqtt/issues/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. **[#&#8203;169](https://github.com/wind-c/comqtt/issues/169) [#&#8203;170](https://github.com/wind-c/comqtt/issues/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.** `MatchTopic` returned `true` after exhausting filter parts without checking whether topic parts remained, so a literal ACL filter such as `allowed` also matched publishes to `allowed/secret`. Matching now requires `len(topicParts) == len(filterParts)`. - **`#` wildcard non-compliance.** The bounds check returned `false` before testing whether the filter part was `#`, so the multi-level wildcard could not match zero sublevels as MQTT 4.7 requires. Now `MatchTopic('a/#', 'a')` is `true` while `MatchTopic('a/+', 'a')` stays `false`. **[#&#8203;171](https://github.com/wind-c/comqtt/issues/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 [@&#8203;MattFiocca](https://github.com/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 | ```sh helm repo add comqtt oci://ghcr.io/wind-c/charts helm upgrade --install comqtt comqtt/comqtt --version 0.5.0 ``` Note 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: - [@&#8203;mattfiocca](https://github.com/mattfiocca) — raft log typo fixes ([#&#8203;171](https://github.com/wind-c/comqtt/issues/171)) - [@&#8203;goingforstudying-ctrl](https://github.com/goingforstudying-ctrl) — raft snapshot restore fix ([#&#8203;173](https://github.com/wind-c/comqtt/issues/173)), Inflight deadlock/quota/ordering fix ([#&#8203;174](https://github.com/wind-c/comqtt/issues/174)) - [@&#8203;TeamAtlanta](https://github.com/TeamAtlanta) — reported the ACL bypass ##### Upgrade notes - Binary and image users: pull `ghcr.io/wind-c/comqtt:2.6.6` (or the floating `v2.6` tag). - No config file schema changes; existing YAML keeps working as-is. - Cluster operators on `>= 2.6.0` should 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**: <https://github.com/wind-c/comqtt/compare/v2.6.5...v2.6.6> </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzQuMSIsInVwZGF0ZWRJblZlciI6IjQ0LjEzNC4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->
renovate_bot commented 2026-10-16 22:12:34 +00:00 (Migrated from jonasled.dev)

mentioned in issue #1

mentioned in issue #1
renovate_bot commented 2026-10-21 22:04:26 +00:00 (Migrated from jonasled.dev)

changed title from Update module github.com/wind-c/comqtt/v2 to v2.6.6 to Update module github.com/wind-c/comqtt/v2 to v2.6.7

<p>changed title from <code class="idiff">Update module github.com/wind-c/comqtt/v2 to v2.6.<span class="idiff left right deletion">6</span></code> to <code class="idiff">Update module github.com/wind-c/comqtt/v2 to v2.6.<span class="idiff left right addition">7</span></code></p>
renovate_bot commented 2026-10-21 22:04:26 +00:00 (Migrated from jonasled.dev)

changed the description

changed the description
renovate_bot commented 2026-10-21 22:04:31 +00:00 (Migrated from jonasled.dev)

added 1 commit

  • c3bd9a79 - Update module github.com/wind-c/comqtt/v2 to v2.6.7

Compare with previous version

added 1 commit <ul><li>c3bd9a79 - Update module github.com/wind-c/comqtt/v2 to v2.6.7</li></ul> [Compare with previous version](/jonasled/fms32-pro-mqtt/-/merge_requests/94/diffs?diff_id=79741&start_sha=26287fa8075f3f94ad6d37d490f7691a538be99d)
jonasled (Migrated from jonasled.dev) merged commit 496f402d3d into master 2026-10-26 21:13:44 +00:00
jonasled commented 2026-10-26 21:13:45 +00:00 (Migrated from jonasled.dev)

mentioned in commit 496f402d3d

mentioned in commit 496f402d3d4c86e8452ff8a21b33baa07fdf1f05
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jonasled/fms32-pro-mqtt!95
No description provided.