Skip to content

[fix][io] Close the kafka source connector got stuck#20698

Merged
poorbarcode merged 7 commits intoapache:masterfrom
poorbarcode:fix/kafka_source_stuck
Jun 30, 2023
Merged

[fix][io] Close the kafka source connector got stuck#20698
poorbarcode merged 7 commits intoapache:masterfrom
poorbarcode:fix/kafka_source_stuck

Conversation

@poorbarcode
Copy link
Copy Markdown
Contributor

@poorbarcode poorbarcode commented Jun 30, 2023

Motivation

#19880 (comment) When Kafka connector is closing, it waits for the runnerThread to stop, but the task-close is running at the same thread, so it will be stuck.

Modifications

run close in another thread.

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: x

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Jun 30, 2023
private volatile boolean running = false;
private KafkaSourceConfig kafkaSourceConfig;
private Thread runnerThread;
private final Executor executor = Executors.newSingleThreadExecutor();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to set a thread name for debugging purpose.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And when the executor will be closed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to set a thread name for debugging purpose.

fixed

And when the executor will be closed?

changed it to a static variable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already remove the executor, and just new one thread if needed

@poorbarcode poorbarcode changed the title [fix][io] Close the kafka source connector close stuck [fix][io] Close the kafka source connector got stuck Jun 30, 2023
Comment thread pulsar-io/kafka/src/main/java/org/apache/pulsar/io/kafka/KafkaAbstractSource.java Outdated
@mattisonchao
Copy link
Copy Markdown
Member

We only use this thread once. Maybe we can new a thread and then run the close task?

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 30, 2023

Codecov Report

Attention: Patch coverage is 71.42857% with 2 lines in your changes missing coverage. Please review.

Project coverage is 73.17%. Comparing base (0e60340) to head (e64e835).
Report is 1739 commits behind head on master.

Files with missing lines Patch % Lines
...rg/apache/pulsar/io/kafka/KafkaAbstractSource.java 71.42% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20698      +/-   ##
============================================
+ Coverage     72.60%   73.17%   +0.56%     
- Complexity    32018    32105      +87     
============================================
  Files          1855     1871      +16     
  Lines        138569   138964     +395     
  Branches      15250    15283      +33     
============================================
+ Hits         100605   101682    +1077     
+ Misses        29945    29239     -706     
- Partials       8019     8043      +24     
Flag Coverage Δ
inttests 24.14% <0.00%> (+0.03%) ⬆️
systests 25.10% <0.00%> (?)
unittests 72.42% <71.42%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...rg/apache/pulsar/io/kafka/KafkaAbstractSource.java 69.71% <71.42%> (+0.65%) ⬆️

... and 174 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@poorbarcode
Copy link
Copy Markdown
Contributor Author

The failed OWASP dependency check will be fixed by #20699

@poorbarcode poorbarcode merged commit c5237ea into apache:master Jun 30, 2023
poorbarcode added a commit that referenced this pull request Jun 30, 2023
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck.

Modifications: run `close` in another thread.
(cherry picked from commit c5237ea)
poorbarcode added a commit that referenced this pull request Jun 30, 2023
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck.

Modifications: run `close` in another thread.
(cherry picked from commit c5237ea)
@poorbarcode poorbarcode deleted the fix/kafka_source_stuck branch July 1, 2023 21:58
Technoboy- pushed a commit that referenced this pull request Jul 3, 2023
Motivation: #19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck.

Modifications: run `close` in another thread.
tisonkun pushed a commit to tisonkun/pulsar that referenced this pull request Jul 12, 2023
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jul 17, 2023
Motivation: apache#19880 (comment) When Kafka connector is closing, it waits for the `runnerThread` to stop, but the task-close is running at the same thread, so it will be stuck.

Modifications: run `close` in another thread.
(cherry picked from commit c5237ea)
(cherry picked from commit 3a2e593)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants