Chia-Ping Tsai created KAFKA-21443:
--------------------------------------
Summary: `lock()` should be called before the `try` block whose
`finally` calls `unlock()`.
Key: KAFKA-21443
URL: https://issues.apache.org/jira/browse/KAFKA-21443
Project: Kafka
Issue Type: Improvement
Reporter: Chia-Ping Tsai
Assignee: Chia-Ping Tsai
This is inspired by
[https://github.com/apache/kafka/pull/24130|https://github.com/apache/kafka/pull/24130.]
Otherwise, if `lock()` throws, the `finally` would call `unlock()` on a lock
that is not held and the original exception gets masked by
`IllegalMonitorStateException`.
The following places have the same pattern:
|{{clients/.../consumer/internals/FetchBuffer.java}}|12|76, 91, 107, 118, 127,
136, 145, 167, 198, 214, 246, 264|
|{{clients/.../oauthbearer/internals/secured/RefreshingHttpsJwks.java}}|4|186,
247, 301, 355|
|{{streams/.../processor/internals/TopologyMetadata.java}}|6|181, 193, 219,
229, 251, 298|
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)