Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-2454: Deadlock between log segment deletion and server shutdown. #153

Closed
wants to merge 8 commits into from

Conversation

becketqin
Copy link
Contributor

No description provided.

@asfbot
Copy link

asfbot commented Aug 20, 2015

kafka-trunk-git-pr #179 SUCCESS
This pull request looks good

if(isStarted) {
executor.shutdown()
executor.awaitTermination(1, TimeUnit.DAYS)
// We use the local variable to avoid NullPointerException if another thread shuts down scheduler at same time.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should work, but do you think it would be clearer to just introduce a shutdownLock?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jjkoshy Good idea, a shutdownLock will make it more clear. I'll do that. Thanks.

@asfbot
Copy link

asfbot commented Aug 23, 2015

kafka-trunk-git-pr #197 SUCCESS
This pull request looks good

shutdownLock synchronized {
if (isStarted) {
this synchronized {
this.executor.shutdown()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this needs to be synchronized.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually you probably do need to (but unnecessary if we are handling rejected executions in schedule - which we are not)

@becketqin
Copy link
Contributor Author

@jjkoshy Thanks for the comments. I submitted the updated patch. It seems a little tricky to make things right. Do you think the original patch might be simpler?

@asfbot
Copy link

asfbot commented Sep 2, 2015

kafka-trunk-git-pr #323 FAILURE
Looks like there's a problem with this pull request

@jjkoshy
Copy link
Contributor

jjkoshy commented Sep 3, 2015

Yes your original patch is simpler. We may also want to survey our usage of schedule and see if there are places where asynchronously scheduled tasks need to complete before shutdown. (Right now, we would get an IllegalStateException)

@asfbot
Copy link

asfbot commented Sep 3, 2015

kafka-trunk-git-pr #338 SUCCESS
This pull request looks good

@becketqin
Copy link
Contributor Author

@jjkoshy Good point about IllegalStateException, I think we need to shutdown KafkaScheduler at last of the shutdown server sequence. We actually start the scheduler at first when startup. I checked the usage of KafkaScheduler.schedule() and it seems OK to shutdown the scheduler at last.

@becketqin
Copy link
Contributor Author

@jjkoshy I just rebased on trunk.

@jjkoshy
Copy link
Contributor

jjkoshy commented Oct 8, 2015

Can you confirm that shutting down the scheduler at the end is safe? Say, if the log cleaner, or offset cache compaction process runs after those components have been closed - would that be an issue?

@jjkoshy
Copy link
Contributor

jjkoshy commented Oct 8, 2015

I actually think that might be weird right? E.g., for the offset manager it will actually run (since we don't explicitly check if the offset manager has shut down or not). Basically I think it is better to shutdown the scheduler first - to avoid the possibility of some code in a specific component running after that component has been shut down.

@@ -121,7 +123,7 @@ class KafkaScheduler(val threads: Int,

def isStarted: Boolean = {
this synchronized {
executor != null
executor != null && !executor.isShutdown
Copy link
Contributor

Choose a reason for hiding this comment

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

The isShutdown check is redundant right? i.e., since the shutdown and setting to null are in a synchronized block? Also, I think we should change the message in ensureStarted to say "Kafka scheduler is not running." - since it could have been either not started or may have been shut down.

@asfgit asfgit closed this in 3005653 Oct 21, 2015
apurvam added a commit to apurvam/kafka that referenced this pull request Mar 24, 2017
hachikuji pushed a commit to hachikuji/kafka that referenced this pull request Mar 28, 2017
apurvam added a commit to apurvam/kafka that referenced this pull request Mar 31, 2017
jsancio pushed a commit to jsancio/kafka that referenced this pull request Aug 6, 2019
…ning topics (apache#153)

Kafka Streams uses a default segment.ms of 600 seconds for its repartitioning topics.
This is less than the current topic policy minimum, so we're lowering the minimum to
unblock this use case. We will follow up and consider re-raising it later (https://confluentinc.atlassian.net/browse/CPKAFKA-2417).

Reviewers: Ismael Juma <ismael@juma.me.uk>
ambroff pushed a commit to ambroff/kafka that referenced this pull request May 7, 2021
TICKET = N/A
LI_DESCRIPTION = Fixing style to pass gradle checkstyleMain
EXIT_CRITERIA = N/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants