v2.12.2

nats-io/nats-serverv2.12.2Nov 13, 2025by github-actions[bot]

AI Summary

This is a patch release (v2.12.2) of the NATS server focusing on JetStream improvements, bug fixes, and new monitoring capabilities. Key additions include PROXY protocol support for client connections, new metalayer compaction options, and enhanced monitoring endpoints, along with numerous performance optimizations and bug fixes for filestore and Raft consensus.

Key Highlights

  • PROXY protocol (v1 and v2) support for client connections when `proxy_protocol: true` is configured
  • New JetStream metalayer config options (`meta_compact`, `meta_compact_size`) for controlling log compaction
  • Enhanced monitoring with expvar `/debug/vars` endpoint and improved `/jsz` endpoint with direct consumers flag
  • Significant JetStream performance improvements including parallel stream loading at startup and reduced heap allocations
  • Multiple critical bug fixes for filestore (off-by-one errors, race conditions, cache accounting) and Raft consensus

New Features

  • PROXY protocol support (v1 and v2) for client connections
  • JetStream `meta_compact` and `meta_compact_size` configuration options
  • `write_timeout` option for clients, routes, gateways, and leafnodes with values: default, retry, or close
  • expvar `/debug/vars` endpoint on monitoring port
  • Meta cluster snapshot statistics in `/jsz` endpoint
  • Direct consumers flag support (`direct-consumers?true`) for `/jsz` endpoint
  • Implicit republish for streams with subject transforms using `>` for both source and destination
  • Binary stream snapshots preferred by default for new route connections

Full Release Notes

## Changelog

Refer to the [2.12 Upgrade Guide](https://docs.nats.io/release-notes/whats_new/whats_new_212) for backwards compatibility notes with 2.11.x.

### Go Version

- 1.25.4 (#7520)

### Dependencies

- github.com/klauspost/compress v1.18.1 (#7474)
- github.com/nats-io/nats.go v1.47.0 (#7474)
- golang.org/x/sys v0.38.0 (#7538)
- github.com/minio/highwayhash 070ab1a (#7539)

### Added

General

- Support for the PROXY protocol (v1 and v2) for client connections, when `proxy_protocol: true` is set in the config (#7456)

JetStream

- Added `meta_compact` and `meta_compact_size`, advanced JetStream config options to control how many log entries must be present in the metalayer log before snapshotting and compaction takes place (#7484, #7521)
- Added `write_timeout` option for clients, routes, gateways and leafnodes which controls the behaviour on reaching the `write_deadline`, values can be `default`, `retry` or `close` (#7513)

Monitoring

- Added expvar `/debug/vars` endpoint to the monitoring port (#7469)
- Meta cluster snapshot statistics have been added to the `/jsz` endpoint (#7524)
- The `/jsz` endpoint can now show direct consumers with the `direct-consumers?true` flag (#7543)

### Improved

General

- Binary stream snapshots are now preferred by default for nodes on new route connections (#7479)
- Reduced allocations in the sublist and subject transforms (#7519)

JetStream

- Improved the logging for observer mode (#7433)
- Improve interest detection when consumers are created or deleted across different servers (#7440)
- Improved the performance of enforcing `max_bytes` and `max_msgs` limits (#7455)
- Streams and consumers will no longer unnecessarily snapshot when being removed or scaling down (#7495)
- Streams are now loaded in parallel when enabling JetStream, often reducing the time it takes to start up the server (#7482, #7526)
- Log lines and errors related to offline/unsupported assets are now clearer (#7416, #7425)
- Stream catchups will now use delete ranges more aggressively, speeding up catchups of large streams with many interior deletes (#7512)
- Streams with subject transforms can now implicitly republish based on those transforms by configuring `>` for both republish source and destination (#7515)
- A race condition where subscriptions may not be set up before catchup requests are sent after a leader change has been fixed (#7518)
- Reduced heap allocations in hash checks (#7539)
- Healthchecks now correctly report when streams are catching up, instead of showing them as unhealthy (#7535)
- Potentially reduced the number of calls to the account resolver for assets that are not resident on that server (#7537)

### Fixed

General

- When using message tracing, header corruption when setting the hop header has been fixed (#7443)
- Fixed a bug when validating leafnode proxies (#7444)
- Fixed a regression where token authentication would not be parsed correctly in leafnode URLs (#7452)
- Gateway subscribe/unsubscribe will no longer block on account fetches (#7449) 
- Shutting down a server using lame-duck mode should no longer result in max connection exceeded errors (#7527)

JetStream

- Caches will now no longer expire unnecessarily when re-reading the same sequences multiple times in first-matching code paths (#7435)
- Fixed a bug in atomic batching where the incorrect field would be checked when looking for unsupported headers (#7436)
- Fixed a deadlock that could happen when interleaving a direct get request with a batch write (#7458)
- A couple of issues related to header handling have been fixed (#7465)
- No-wait requests now return a 400 No Messages response correctly if the stream is empty (#7466)
- Raft groups will now only report leadership status after a no-op entry on recovery (#7460)
- Fixed a race condition in the filestore that could happen between storing messages and shutting down (#7496)
- A panic that could occur when recovering streams in parallel has been fixed (#7503)
- An off-by-one when detecting holes at the end of a filestore block has been fixed (#7508)
- Indexing a message block in the filestore no longer tries to adjust the cache first sequence (#7508)
- Writing skip message records in the filestore no longer releases and reacquires the lock unnecessarily (#7508)
- Writing message records only overwrites the cache first sequence on the first indexed write (#7508)
- Fixed a bug on metalayer recovery where stream and consumer monitor goroutines for recreated assets would run with the wrong Raft group (#7510)
- Scaling up an asset from R1 now results in an installed snapshot, allowing recovery after restart if interrupted, avoiding a potential desync (#7509)
- Raft groups should no longer report no quorum incorrectly when shutting down (#7522)
- Consumers that existed in a metalayer snapshot but were deleted on recovery will no longer result in failing healthchecks (#7523)
- An off-by-one when detecting holes at the end of a filestore block has been fixed (#7525)
- Fixed a race condition that could happen with shutdown signals when shutting down JetStream (#7536)
- Fixed an issue in the filestore where skipping message sequences did not correctly update the cache accounting (#7534)
- Fixed a deadlock that could occur when purging a stream with mismatched consumer state (#7546)

### Complete Changes
 
https://github.com/nats-io/nats-server/compare/v2.12.1...v2.12.2