Skip to content

[Bug] External NATS JetStream: OpenCloud downgrades main-queue replication from R3 to R1 #3869

Closed
opencloud-eu/reva
#984

Description

@Ezanor

[Bug] External NATS JetStream: OpenCloud downgrades main-queue replication from R3 to R1

Describe the bug

When OpenCloud is connected to an external 3-node NATS JetStream cluster, the main-queue stream is automatically downgraded from 3 replicas (R3) to 1 replica (R1).

Even when main-queue is manually configured with num_replicas: 3, an OpenCloud service initialization or restart can change its configuration back to num_replicas: 1.

This defeats the high-availability setup of the external NATS cluster. If the NATS node hosting the stream becomes unavailable, the stream may no longer be available.

Environment

  • OpenCloud: 9.x (external NATS configuration)
  • NATS Server: 2.15.0
  • NATS Go client: 1.54.0
  • NATS topology: 3-node cluster with JetStream enabled
  • OpenCloud deployment: multiple services / instances
  • Event stream: main-queue

OpenCloud is configured to use an external NATS cluster rather than its embedded NATS server.

Steps to reproduce

  1. Set up a 3-node NATS cluster with JetStream enabled.

  2. Configure OpenCloud to use this external NATS cluster.

  3. Start OpenCloud and allow it to initialize its NATS streams.

  4. Manually change the main-queue stream replication factor to 3:

    nats stream edit main-queue --replicas 3
  5. Verify the stream configuration:

    nats stream info main-queue

    The stream should report num_replicas: 3.

  6. Restart an OpenCloud service, or wait for the service initialization/reconnection that triggers the issue.

  7. Check the stream configuration again.

Actual behavior

The main-queue stream is changed back to num_replicas: 1.

JetStream API audit logs identify the OpenCloud storage-users:bus client as the source of the operation.

The following sequence was captured on the NATS cluster:

1. The OpenCloud client attempts to create the stream

API subject:

$JS.API.STREAM.CREATE.main-queue

Client:

name: storage-users:bus
user: opencloud

The request contains:

{
  "name": "main-queue",
  "retention": "limits",
  "storage": "file",
  "num_replicas": 0
}

NATS returns:

{
  "error": {
    "code": 400,
    "err_code": 10058,
    "description": "stream name already in use with a different configuration"
  }
}

2. Immediately afterwards, the same OpenCloud client updates the existing stream

API subject:

$JS.API.STREAM.UPDATE.main-queue

The API audit response confirms that the resulting stream configuration is:

{
  "config": {
    "name": "main-queue",
    "num_replicas": 1
  }
}

This sequence was captured on October 30, 2026, at 14:48:19 UTC.

The API audit identifies the client as storage-users:bus, rather than an external NATS administrator or another NATS client.

Expected behavior

OpenCloud should not silently downgrade the replication factor of an existing JetStream stream.

Ideally:

  • The replication factor of JetStream streams managed by OpenCloud should be configurable.
  • An administrator should be able to specify num_replicas: 3 for a 3-node NATS cluster.
  • Existing streams configured with a higher replication factor should not be silently downgraded during service initialization or reconnection.
  • The configured replication factor should be consistently applied when streams are created or updated.

For example, an environment variable such as OC_EVENTS_REPLICAS=3 could be provided, or an equivalent configuration option.

It would also be useful to have the same configuration capability for other OpenCloud-managed JetStream streams and KV buckets.

Activity

  1. moved this from Qualification to Prio 1 in OpenCloud Team Boardon Nov 2, 2026
  2. moved this from Prio 1 to Prio 2 in OpenCloud Team Boardon Nov 2, 2026
  3. self-assigned this
    on Nov 9, 2026
  4. added a commit that references this issue on Nov 9, 2026
    d897df8
  5. moved this from Prio 2 to Needs Review in OpenCloud Team Boardon Nov 9, 2026
  6. micbar commented on Nov 11, 2026

    @micbar
    Member

    Needs review.

  7. moved this from Needs Review to In Progress in OpenCloud Team Boardon Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions