Commit ee29e34
committed
KAFKA-20253: Trigger rejoin on heartbeat thread AuthenticationException
The AuthenticationException catch in HeartbeatThread#run only calls
setFailureCause(e) and exits, so the member stays STABLE, rejoinNeeded
stays false, and heartbeatThread is cleared to null. The main thread's
timeToNextHeartbeat() then returns 0 from the stale heartbeatTimer,
causing NetworkClient.poll(0) to spin via selectNow() indefinitely.
Extend the existing "error -> requestRejoin()" pattern already used in
HeartbeatResponseHandler to the auth catch, so the next poll() runs
ensureActiveGroup() -> startHeartbeatThreadIfNeeded() ->
heartbeat.resetTimeouts(), restoring consumer state. Verified with a
new unit test and end-to-end via mstruk/kafka-consumer-reproducer
(101% -> ~0.3% CPU, fresh generation).1 parent 678c0e0 commit ee29e34
2 files changed
Lines changed: 38 additions & 0 deletions
File tree
- clients/src
- main/java/org/apache/kafka/clients/consumer/internals
- test/java/org/apache/kafka/clients/consumer/internals
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1571 | 1571 | | |
1572 | 1572 | | |
1573 | 1573 | | |
| 1574 | + | |
1574 | 1575 | | |
1575 | 1576 | | |
1576 | 1577 | | |
| |||
Lines changed: 37 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1291 | 1328 | | |
1292 | 1329 | | |
1293 | 1330 | | |
| |||
0 commit comments