Skip to content
cabby v0.6.0Cabby 0.6.0 release notes

Upgrading to 0.6

These are the changes in Cabby 0.6 that may ask something of you. If your setup isn't in the middle column, upgrade as usual.

Change Who is affected Keep the old behavior
The server generates every session id Something relies on the session id being the X-Request-ID header --request_id_as_session_id
Redis over TLS checks the certificate rediss:// with a self-signed certificate, a private CA, or a certificate for other names --redis_tls_verify=false, or --redis_tls_ca_cert_path for a private CA
Each stream has its own epoch --broker=postgres with --postgres_auto_migrate=false, or with several nodes Nothing to keep: run one ALTER TABLE first, and finish restarting every node
A node that loses NATS keeps reconnecting max_reconnect_attempts under [nats], as in a file written by --print-config Nothing to keep: remove the setting, or set it to -1
Whispers reach only subscriptions that take whispers Clients read whispers through a subscription that doesn't whisper on that stream, such as Turbo Streams Nothing to keep: enable whispers on that subscription, and set --whisper_compat_0_5 while 0.5 nodes run
A session is restored once A client reconnects with an id it already restored, or while that session is still connected Nothing to keep: such a client gets a new session
none turns a key off none as --turbo_streams_secret, --cable_ready_secret or --api_secret Nothing to keep: give those a real key
Public streams refuse Pusher's private names Unsigned private- or presence- names on public streams, with the Pusher endpoint on Nothing to keep: sign those names
Idle keep-alive connections are closed A client or load balancer that keeps a connection idle for over 620 seconds --idle_timeout=0, or a value above your load balancer's
Slow SSE, Durable Streams and Pusher clients are disconnected Such clients fall more than 1 MiB behind and catch up later A higher --ws_max_pending_size, or 0

Session ids

What changes. Cabby generates every session id: 21 characters for a WebSocket, SSE or Durable Streams session, and a socket id in Pusher's format (<digits>.<digits>) for a Pusher connection. Until 0.5, a valid X-Request-ID header became the session id, and in Pusher's format the socket id. The header now goes to the log, after the session id:

DBG WebSocket session established sid=NsH_e59GkJgF-cO1IsQyv request_id=4b1f0a7c-req

Session restore (?sid=, X-Cabby-Restore-Sid) works as before.

Who is affected. A proxy or a client sets X-Request-ID, and something relies on the session id being that value:

  • your app looks sessions up by the request id;
  • a log search joins the proxy's request id with Cabby's sid=;
  • a Pusher client picks its socket id through the header instead of reading it from pusher:connection_established.

Check before upgrading. If nothing in front of Cabby sets X-Request-ID (Heroku's router does, and so does an Nginx with proxy_set_header X-Request-ID $request_id), you're not affected. If something does, start Cabby 0.5 with --debug: when sid= in WebSocket session established is your proxy's request id rather than 21 random characters, look for anything that reads it.

Keep the old behavior. Set --request_id_as_session_id, CABBY_REQUEST_ID_AS_SESSION_ID=true, or request_id_as_session_id = true under [server]. It has a CABBY_* name only. With it on, the header is the sid and nothing more is logged.

If you get it wrong. Nothing fails and nothing is logged: whatever looks a session up by the request id simply doesn't find it.

Redis over TLS

What changes. With rediss:// (or valkeys://), Cabby checks the Redis server's certificate: it has to be signed by a CA your system trusts, or by the one in --redis_tls_ca_cert_path, and be issued for the host in the URL. A TLS connection checks who it is talking to unless told not to. This covers Redis pub/sub, the redis and redisx broadcast adapters, the Redis broker and, with --redis_sentinel_tls, the Sentinel nodes. Plain redis:// is not affected.

Who is affected. Deployments whose certificate doesn't pass:

  • a self-signed certificate, or one from a private CA without --redis_tls_ca_cert_path;
  • a certificate for other names than the host in the URL, such as a URL with an IP address and a certificate for a host name;
  • with Sentinel, a master whose certificate is valid neither for the address the Sentinel gives for it nor for the host of the first --redis_sentinels address;
  • with a Redis Cluster, the redisx adapter and the Redis broker follow the cluster's own list of nodes, so each node's certificate has to be valid for the address the node announces (its IP address, unless the cluster announces host names). A managed cluster whose nodes announce IP addresses and carry a certificate for the endpoint's name is in this group. Redis pub/sub and the redis adapter use only the nodes given in the URL.

A single Redis server with a publicly trusted certificate for the host in the URL, as managed Redis services usually have, needs no change.

Check before upgrading. If Cabby 0.5 logs this at startup, it doesn't check the certificate today:

WRN Redis server TLS certificate is not verified; set --redis_tls_verify=true to enable verification

Then ask OpenSSL about the host in your URL (add -CAfile with your CA's file for a private CA). If it doesn't answer Verify return code: 0 (ok), Cabby 0.6 refuses the certificate too:

openssl s_client -connect redis.internal:6380 -verify_hostname redis.internal -verify_return_error </dev/null

Keep the old behavior. Set --redis_tls_verify=false, CABBY_REDIS_TLS_VERIFY=false, or tls_verify = false under [redis]; Cabby logs the warning above at startup. For a private CA, give its certificate with --redis_tls_ca_cert_path instead and connect by a host name the certificate is issued for: the connection stays checked. An adapter's own Redis section in the configuration file ([redis_pubsub.Redis], [redis_stream_broadcast.redis], [redis_pubsub_broadcast.redis]) checks too unless it says tls_verify = false.

If you get it wrong. Pub/sub and each Redis broadcast adapter log the refusal on every connection attempt, and keep retrying:

ERR failed to connect to Redis context=pubsub error="invalid peer certificate: UnknownIssuer"
ERR failed to connect to Redis context=pubsub error="invalid peer certificate: certificate not valid for name \"10.0.0.5\"; certificate is only valid for DnsName(\"redis.internal\")"

UnknownIssuer means no CA Cabby trusts signed it; certificate not valid for name means the host isn't on the certificate. With --broker=redis, Cabby stops at startup:

failed to start broker, cause: failed to start the Redis broker, cause: invalid peer certificate: UnknownIssuer

A Redis Cluster node is named, with the address its certificate has to carry (Redis has the rules):

Redis Cluster node 10.0.0.7:6380: invalid peer certificate: certificate not valid for name "10.0.0.7"; certificate is only valid for DnsName("redis.internal"); its certificate must be valid for 10.0.0.7, the address the node announces

PostgreSQL broker

What changes. With --broker=postgres, each stream has an epoch of its own, in a new epoch column of cabby_streams. A stream that got no message for 10 × --history_ttl used to reuse its old offsets, so one position could name two messages; its next message now starts again at offset 1 in a new epoch. Streams that exist at the upgrade keep their epoch, so connected clients don't resync.

Who is affected. Every setup with --broker=postgres, in two ways:

  • The first upgraded node to start adds the column. It changes only the catalog, but takes the table's lock for a moment: the start waits at most 5 seconds for it, and broadcasts wait behind it. With --postgres_auto_migrate=false, Cabby doesn't add it.
  • While nodes of 0.5 and 0.6 run side by side, a stream first written by an upgraded node has two epochs. A client whose last message came through the other kind of node is told its position is unknown when it reconnects (reject_history) and loads the current state again, and a node catching up after a pub/sub outage delivers such a stream's kept messages a second time. No message is lost.

What to do. With --postgres_auto_migrate=false, run this before the upgrade, with your schema and table prefix:

ALTER TABLE "public"."cabby_streams" ADD COLUMN epoch TEXT;

Then restart every node within one upgrade. One node at a time is fine; just don't leave a mixed set running. With regular tables (--postgres_unlogged=false), the cleanup after restoring the database to an earlier point has changed: PostgreSQL shows it.

If you get it wrong. Without the column, an upgraded node with --postgres_auto_migrate=false stops at startup:

failed to start broker, cause: failed to start Postgres broker, cause: column epoch of table public.cabby_streams is missing: run ALTER TABLE "public"."cabby_streams" ADD COLUMN epoch TEXT or set --postgres_auto_migrate=true

A mixed set left running shows up as clients told their position is unknown, and a rising rejected_history_requests_total.

NATS

What changes. A node that loses NATS keeps trying to reconnect, with no limit: max_reconnect_attempts under [nats] is now -1 by default (it was 5). The broker, NATS pub/sub and the NATS broadcast adapter try again at once, then after 250 ms, then further apart, up to 30 s. Each logs the loss once (connection failed) and the recovery once (connection restored), and clients get the messages they missed meanwhile. Until 0.5, a connection gave up after 5 attempts, about 10 seconds, and stayed closed: with the NATS broker, broadcasts answered 501 until a restart. The broker also repairs its copy of a stream's history after NATS deletes a consumer or loses its data (NATS).

Who is affected.

  • A configuration file that sets max_reconnect_attempts under [nats], such as one written by --print-config of Cabby 0.5, which holds max_reconnect_attempts = 5. A positive limit now ends the node: once its attempts in a row run out, it exits with status 1, with 5 attempts after 15 to 30 seconds without NATS.
  • Anything that relied on a node running on without NATS once its attempts ran out.

Check before upgrading. Look for max_reconnect_attempts under [nats] in your configuration file. The one under [redis] is another setting and doesn't change.

What to do. To keep trying for ever, remove the line or set it to -1. To cap the attempts and let a supervisor (systemd, Docker, Kubernetes) start the node again, keep a positive number.

If you get it wrong. A node whose limit runs out exits with status 1, and its log has failed to reconnect to NATS: attempts exceeded.

Whispers

What changes. A whisper is a message between subscribers that chose to exchange them, so it now reaches only the subscriptions that take whispers on its stream, and never the client that sent it: a $pubsub subscription with --streams_whisper, a public stream, a channel that opens the stream with whisper: true, a Pusher private- or presence- channel. Until 0.5, a whisper went to every subscriber of the stream as an ordinary message: a Turbo Streams or CableReady subscription of that name, or a channel streaming from it without whisper: true, got it as if your app had broadcast it.

Who is affected. Apps whose clients read whispers through a subscription that doesn't take whispers itself, such as a channel that streams from a stream other clients whisper to through $pubsub.

Check before upgrading. For each stream your clients whisper to, look at how the readers subscribe. If each of them can whisper there too (whisper: true, --streams_whisper or a public stream), nothing changes for you.

What to do. Enable whispers on the reading subscription (stream_from name, whisper: true).

Node by node. While nodes of 0.5 and 0.6 share pub/sub, a 0.5 node ignores the way 0.6 nodes pass whispers on: whispers sent through a 0.6 node don't reach the clients of 0.5 nodes, while whispers sent through a 0.5 node still reach every subscriber on every node. Set --whisper_compat_0_5 (CABBY_WHISPER_COMPAT_0_5=true, or whisper_compat_0_5 = true under [app]) on the 0.6 nodes until the last 0.5 node is gone, then remove it. A 0.6 node with it sends whispers in the form 0.5 nodes deliver; the 0.6 nodes still deliver them only to the subscriptions that take whispers.

If you get it wrong. Nothing fails and nothing is logged: the readers stop getting whispers.

Session restore

What changes. With the extended protocol (actioncable-v1-ext-json, as @cabby/web uses it) and a broker that keeps sessions, a session is restored once, and only after it has gone: a session id belongs to one connection. A client that reconnects with an id that has already restored a session, or with the id of a session that is still connected, gets a new session: your app's connect runs, the client subscribes again, and its history requests still bring back what it missed. With the Redis, NATS and PostgreSQL brokers this holds across nodes. Until 0.5, an id restored any number of connections for --sessions_ttl, the connected one included.

Who is affected. Clients that reconnect with an id they have used to restore before, or open a second connection with the id of one still open. A rolling restart restores as before, since a node disconnects its sessions when it stops; a node that is killed leaves its sessions unrestorable until --sessions_ttl passes.

Check before upgrading. Each restore gives the client a new session id in its welcome. A client of your own that restores sessions has to send that latest id at its next reconnect, not the first one. @cabby/web does.

What to do. Nothing to set.

If you get it wrong. No error: the welcome has no "restored":true, your app's connect runs again, and failed_session_restores_total rises.

Keys set to none

What changes. none turns a single key off. For --turbo_streams_secret and --cable_ready_secret it now means no key at all: every Turbo Streams (or CableReady) name is refused, with no fallback to --streams_secret or --secret. Until 0.5, none was the key itself, so names signed with the string none passed. --api_secret=none stops Cabby at startup, since an API without a key takes every request.

Who is affected. Setups that sign names or API requests with the literal key none.

Check before upgrading. Look for none as the value of --turbo_streams_secret, --cable_ready_secret or --api_secret, in flags, CABBY_* variables and the configuration file.

What to do. Give those a real key, or remove the setting.

If you get it wrong. Turbo Streams (or CableReady) subscriptions get reject_subscription. With --api_secret=none, Cabby stops at startup with:

--api_secret is "none": the API would take requests without authorization. Set a secret for it (or --secret), or remove the setting

Public streams

What changes. With --public_streams (or --public) and the Pusher endpoint configured (--pusher_app_id and --pusher_app_key), unsigned names that start with private- (which includes private-encrypted-) or presence- are refused: those are the channels a Pusher client needs a signature for. A WebSocket or SSE subscription is rejected, and a Durable Streams read gets 401. Signed names of that form work as before, and without the Pusher endpoint such names are public streams like any other.

Who is affected. Clients that read a Pusher private- or presence- channel through an unsigned public stream.

Check before upgrading. With --public_streams and the Pusher settings both on, look in your clients for unsigned $pubsub subscriptions, ?stream= URLs or Durable Streams paths with those prefixes.

What to do. Subscribe with a signed name, or move data every client may read to a name without those prefixes.

If you get it wrong. The subscription gets reject_subscription, and with --debug Cabby logs subscription failed with error="invalid identifier, cause: public streams can't use the names of authorized Pusher channels".

Idle connections

What changes. An HTTP keep-alive connection that waits more than 620 seconds for its next request is closed, on every port Cabby serves; the metrics server keeps its 60 seconds. Only a connection waiting between requests counts: WebSocket connections, SSE and Durable Streams responses, long polls and requests in progress are never closed by it. Until 0.5, an idle connection stayed open until the client closed it, and with --max-conn idle connections could hold every slot.

Who is affected. Clients or load balancers that keep a connection to Cabby idle for more than 620 seconds and then send a request on it without handling a closed connection, and load balancers whose idle timeout for backend connections is above 620 seconds.

Check before upgrading. Look up your load balancer's idle timeout for backend connections. AWS ALB and nginx upstream keep-alive use 60 seconds by default, Google Cloud load balancers 600: all below 620.

Keep the old behavior. Set --idle_timeout=0, CABBY_IDLE_TIMEOUT=0, or idle_timeout = 0 under [server]. Behind a load balancer that keeps connections longer, set it above the load balancer's idle timeout instead, so that the load balancer closes an idle connection first.

If you get it wrong. With a value below the load balancer's idle timeout, a request can arrive just as Cabby closes the connection, and the client gets a 502 from the load balancer.

Slow clients

What changes. SSE, Durable Streams and Pusher clients get the limit WebSocket clients have: a client with more than --ws_max_pending_size bytes (1 MiB) waiting for it is disconnected as too slow, and counted in disconnected_slow_clients_total. Until 0.5, Cabby kept everything such a client hadn't read, and used more memory for as long as the client stayed. Pusher clients also take --ws_write_timeout now, instead of always 2 seconds, its default.

Who is affected. SSE, Durable Streams and Pusher clients that fall more than 1 MiB behind the messages sent to them and catch up later, such as a client on a slow link that gets large broadcasts in bursts.

Check before upgrading. Nothing to check on 0.5, which never cuts these clients off. After the upgrade, disconnected_slow_clients_total counts them next to WebSocket clients.

Keep the old behavior. Raise --ws_max_pending_size (max_pending_size under [ws]), or set it to 0, which lifts the limit for WebSocket clients too.

If you get it wrong. No error: the client is disconnected and reconnects. EventSource resumes with Last-Event-ID, a Durable Streams client reads on from its offset, and disconnected_slow_clients_total rises.

Also in 0.6

  • Two apps can now share one Redis: each sets its own channel prefix with --redis_pubsub_channel_prefix, next to its own key prefix and broadcast stream (Redis). Unset, nothing changes.
  • If a client joined a stream's presence on its own before your app's first join on that subscription, the app's join now replaces it: the members get the client's leave, then the app's join. Before, the app's join failed with presence ID mismatch.
  • While the WebSocket endpoint accepts every origin (--allowed_origins empty, the default, or *), Cabby warns at startup: a browser sends the user's cookies with a WebSocket connection, whatever page opens it (Troubleshooting).
  • Without a key, the HTTP broadcast endpoint and the API are announced at warn level, with what anyone who reaches them can do.
  • The debug line no subprotocol negotiated masks the token of a cabby-token.<jwt> subprotocol.
  • paths under [ws] and proxy_headers under [rpc] in the configuration file now take effect; until 0.5, the defaults of --path and --headers replaced them. Check what yours say: proxy_headers = [] now passes no Cookie header to your app.
  • With --turbo_streams or --cable_ready and one key for those names and signed $pubsub streams, Cabby warns at startup that those signed names also work on $pubsub (Authentication).
  • --pusher_public_channel_prefix keeps Pusher clients to the public channels that start with it (Migrating from Pusher). Unset, nothing changes.
  • With NATS pub/sub, Cabby doesn't subscribe to a stream whose name NATS would read as a pattern (chat.>) or that starts with $ or _ac_ (NATS).