Scenario 25.1.5 · Schema Registry down: a restart stops the client
Kafka Schema Registry down: a restarted client stops
With SR down a restarted producer cannot serialize and a restarted consumer cannot deserialize. A warm producer next to them keeps writing.
Run this scenario in the playgroundtwo warm producers, one consumer. t+0.000s
p1 and p2 write orders with schema id 1 (p2 runs with auto.register.schemas=false); c1 reads them. All three have the id cached.
Open at this step: step 1, two warm producers, one consumerO1 written and read. t+1.000s
Steady state: no client talks to Schema Registry.
Open at this step: step 2, O1 written and readsr-1 down. t+1.300s
The only SR instance dies. Kafka is healthy.
Open at this step: step 3, sr-1 downp1 restarted: its send fails. t+1.900s
p1 restarted with an empty schema cache. Its next send must ask SR for the id of orders-value v1, no instance answers, and the serializer throws before the record reaches the batch. Nothing is appended.
Open at this step: step 4, p1 restarted: its send failsc1 restarted: stuck at P1. t+2.900s
c1 restarted too. p2, still warm, keeps writing P1 and P2, but c1 cannot look up the id of P1: it stops at that record. It stays in the group (no rebalance) while its lag grows.
Open at this step: step 5, c1 restarted: stuck at P1SR back: both recover. t+4.000s
sr-1 is back. c1 looks up id 1, reads P1 and P2 and catches up; p1 resolves the id and its O2 goes through. Both caches are warm again.
Open at this step: step 6, SR back: both recoverp2 deploys v2: not registered. t+4.700s
p2 runs with auto.register.schemas=false and is redeployed with schema v2, which nobody registered. SR is up, but its serializer only looks the schema up, finds no such version and throws: schema not found. Register the version first, from CI.
Open at this step: step 7, p2 deploys v2: not registeredWhat you start with
Two producers write orders with schema id 1; one consumer reads them. Then the only Schema Registry instance dies and, as in a deploy, p1 and the consumer restart. A restarted process starts with an empty schema cache.
Step by step
- two warm producers, one consumer t+0.000s p1 and p2 write orders with schema id 1 (p2 runs with auto.register.schemas=false); c1 reads them. All three have the id cached. Open at this step: step 1, two warm producers, one consumer
- O1 written and read t+1.000s Steady state: no client talks to Schema Registry. Open at this step: step 2, O1 written and read
- sr-1 down t+1.300s The only SR instance dies. Kafka is healthy. Open at this step: step 3, sr-1 down
- p1 restarted: its send fails t+1.900s p1 restarted with an empty schema cache. Its next send must ask SR for the id of orders-value v1, no instance answers, and the serializer throws before the record reaches the batch. Nothing is appended. Open at this step: step 4, p1 restarted: its send fails
- c1 restarted: stuck at P1 t+2.900s c1 restarted too. p2, still warm, keeps writing P1 and P2, but c1 cannot look up the id of P1: it stops at that record. It stays in the group (no rebalance) while its lag grows. Open at this step: step 5, c1 restarted: stuck at P1
- SR back: both recover t+4.000s sr-1 is back. c1 looks up id 1, reads P1 and P2 and catches up; p1 resolves the id and its O2 goes through. Both caches are warm again. Open at this step: step 6, SR back: both recover
- p2 deploys v2: not registered t+4.700s p2 runs with auto.register.schemas=false and is redeployed with schema v2, which nobody registered. SR is up, but its serializer only looks the schema up, finds no such version and throws: schema not found. Register the version first, from CI. Open at this step: step 7, p2 deploys v2: not registered
The takeaway
A restart turns an SR outage into an application outage: the serializer throws before the record reaches Kafka, the deserializer stops the consumer at the record it cannot decode. Run more than one SR instance, and do not roll clients while SR is down. With auto.register.schemas=false a new version must be registered before the deploy, or the producer stops even with SR up.
Embed this scenario
Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.
<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=25.1.5" title="Kafka Simulator: Schema Registry down: a restart stops the client" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy" referrerpolicy="no-referrer-when-downgrade"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/sr-down-cold-clients/">Kafka Schema Registry down: a restarted client stops</a></p> Further reading
Troubleshooting
- Kafka SerializationException: Schema Registry unreachable
- Schema not found (40403) in Kafka: causes and fixes
More in Schema registry
- Confluent Schema Registry subjects and versions for Kafka
- Kafka schema compatibility: BACKWARD vs FORWARD vs FULL
- Kafka breaking schema change rejected by Schema Registry
- Kafka Schema Registry down: why warm clients keep going
- Highly available Schema Registry: leader failover
- Schema Registry across two DCs: losing the leader DC
- Schema Registry DR: failover to a follower-only registry
- Two independent Schema Registries break mirrored Kafka data
- Kafka producer schema rejected as incompatible (409)
- Kafka consumer cannot read a new schema under BACKWARD