# SchemaRegistryTimeoutException: 等待模式注册超时

- **ID:** `data/avro-schema-registry-timeout`
- **领域:** data
- **类别:** network_error
- **错误码:** `SchemaRegistryTimeoutException`
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

由于网络拥塞或注册表过载，Kafka Schema Registry客户端在等待注册表确认模式注册时超时。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| confluent-kafka 7.5.0 | active | — | — |
| avro 1.11.3 | active | — | — |
| kafka-avro-serializer 7.5.0 | active | — | — |

## 解决方案

1. ```
   Check Schema Registry health: `curl -f http://schema-registry:8081/subjects` — if unreachable, restart the registry service or check network/firewall rules.
   ```
2. ```
   In producer config, set `schema.registry.request.timeout.ms=10000` and `schema.registry.max.retries=5` to allow transient failures to recover.
   ```
3. ```
   If using Confluent Schema Registry with Docker, ensure the registry container has enough resources: `docker update --memory=2g schema-registry` and check `docker logs schema-registry` for OOM errors.
   ```

## 无效尝试

- **Increase the schema registry request timeout to a very high value (e.g., 5 minutes)** — If the registry is down or network is completely broken, no timeout value will help; it just delays failure. (70% 失败率)
- **Restart the Kafka broker to 'refresh' the schema registry connection** — Schema registry is a separate service from Kafka brokers; restarting brokers doesn't affect registry connectivity. (90% 失败率)
- **Disable schema validation entirely in the producer config** — This bypasses the error but can lead to data corruption downstream if schemas are incompatible. (80% 失败率)
