Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Fix deadlock caused by KafkaTopicConsumerManager #620

Merged

Conversation

BewareMyPower
Copy link
Collaborator

Fixes #618

Motivation

See #618 (comment) for the deadlock analysis.

Modifications

@BewareMyPower BewareMyPower merged commit d13432b into streamnative:master Jul 23, 2021
@BewareMyPower BewareMyPower deleted the bewaremypower/tcm-optimize branch July 23, 2021 13:22
BewareMyPower added a commit to BewareMyPower/kop that referenced this pull request Jul 25, 2021
Fixes streamnative#618 

### Motivation

See streamnative#618 (comment) for the deadlock analysis.

### Modifications
- Use `ConcurrentHashMap` instead of `ConcurrentLongHashMap`. Though this bug may already be fixed in apache/pulsar#9787, the `ConcurrentHashMap` from Java standard library is more reliable. The possible performance enhancement brought by `ConcurrentLongHashMap` still needs to be proved.
- Use `AtomicBoolean` as `KafkaTopicConsumerManager`'s state instead of read-write lock to avoid `close()` method that tries to acquire write lock blocking.
- Run a single cursor expire task instead one task per channel, since streamnative#404 changed `consumerTopicManagers` to a static field, there's no reason to run a task for each connection.
BewareMyPower added a commit that referenced this pull request Jul 25, 2021
Fixes #618 

### Motivation

See #618 (comment) for the deadlock analysis.

### Modifications
- Use `ConcurrentHashMap` instead of `ConcurrentLongHashMap`. Though this bug may already be fixed in apache/pulsar#9787, the `ConcurrentHashMap` from Java standard library is more reliable. The possible performance enhancement brought by `ConcurrentLongHashMap` still needs to be proved.
- Use `AtomicBoolean` as `KafkaTopicConsumerManager`'s state instead of read-write lock to avoid `close()` method that tries to acquire write lock blocking.
- Run a single cursor expire task instead one task per channel, since #404 changed `consumerTopicManagers` to a static field, there's no reason to run a task for each connection.
BewareMyPower added a commit to BewareMyPower/kop that referenced this pull request Jul 25, 2021
BewareMyPower added a commit that referenced this pull request Jul 25, 2021
This PR migrates #620 to branch-2.7.2 because it's hard to cherry-pick.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants