# java.io.IOException: Connection to node -1 (localhost/127.0.0.1:9092) could not be established. Broker may not be available.

- **ID:** `kafka/socket-server-max-too-low`
- **Domain:** kafka
- **Category:** network_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The broker's socket server max connections limit is exhausted because too many concurrent connections from clients exceed the configured value of socket.server.max.connections.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Kafka 3.4.0 | active | — | — |
| Kafka 3.5.0 | active | — | — |
| Kafka 3.6.0 | active | — | — |
| Kafka 3.7.0 | active | — | — |

## Workarounds

1. **Increase the socket.server.max.connections configuration in server.properties and restart the broker:

socket.server.max.connections=2000

Then monitor connections using: netstat -an | grep :9092 | wc -l** (85% success)
   ```
   Increase the socket.server.max.connections configuration in server.properties and restart the broker:

socket.server.max.connections=2000

Then monitor connections using: netstat -an | grep :9092 | wc -l
   ```
2. **Reduce the number of concurrent connections from clients by implementing connection pooling or batching requests. For example, in a Java consumer, use a single shared KafkaConsumer instance instead of creating per-thread consumers.** (75% success)
   ```
   Reduce the number of concurrent connections from clients by implementing connection pooling or batching requests. For example, in a Java consumer, use a single shared KafkaConsumer instance instead of creating per-thread consumers.
   ```

## Dead Ends

- **Restart the broker** — Restarting only temporarily resets connections; the underlying limit is unchanged and will be hit again quickly under high load. (90% fail)
- **Increase heap memory for the broker** — Socket server connections are not directly related to heap memory; the issue is a connection count limit, not memory pressure. (95% fail)
