fix(deps): [OCISDEV-834] recover from dead NATS connections in nats-js-kv#12404
Merged
kobergj merged 1 commit intoJun 12, 2026
Merged
Conversation
…s-kv Bumps the kobergj/plugins nats-js-kv replace pin to fc78af4, which fixes hasConn() to treat a permanently-closed NATS connection as no connection. Previously hasConn() only checked n.conn != nil, so once the client exhausted its reconnect attempts the connection stayed non-nil but dead, initConn() never re-ran, and every KV operation failed with 'nats: connection closed' until the pod was restarted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
mklos-kw
approved these changes
Jun 12, 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.
Problem
The
nats-js-kvgo-micro store plugin'shasConn()only checkedn.conn != nil, not whether the connection was still alive. Once the underlying NATS client exhausted its reconnect attempts (e.g. a NATS pod restart longer than the client's reconnect window),n.connstayed non-nil but permanently closed. BecauseinitConn()is gated on!hasConn(), it never re-ran, so every subsequent KV operation failed withnats: connection closeduntil the affected pod was restarted.This is a base-layer bug in the store plugin used by every oCIS service backed by the NATS KV cache. Confirmed BYCS production manifestations:
OPS workaround to date: rolling-restart the affected pod(s).
Fix
This is a dependency bump only. The
replacedirective forgithub.com/go-micro/plugins/v4/store/nats-js-kvis pointed atkobergj/pluginscommitfc78af4, whosehasConn()now treats a closed connection as no connection:so the next operation transparently re-initializes the connection. (See go-micro/plugins#142 for the upstream change.)
No oCIS source changes — only
go.mod,go.sum, the re-vendored plugin, and a changelog entry.Already backported to stable-8.0 (#12401, merged) and stable-8.1 (#12402).
Follow-up (not in this PR)
The complementary proactive hardening from OCISDEV-834 —
MaxReconnect=-1+ connection-state logging in reva'spkg/store, theloadAttributescache-error tolerance in reva'smessagepack_backend.go, andMaxReconnectonocis-pkg/natsjsregistry— will land in a separate PR (the reva pieces require a reva change + pin bump first). This PR ships the load-bearing self-heal fix on its own.Refs OCISDEV-834.