Skip to content

KAFKA-10157: Fix broken tests due to InterruptedException from FinalizedFeatureChangeListener#8857

Merged
junrao merged 2 commits into
apache:trunkfrom
kowshik:fix_test_KAFKA-10157
Jun 12, 2020
Merged

KAFKA-10157: Fix broken tests due to InterruptedException from FinalizedFeatureChangeListener#8857
junrao merged 2 commits into
apache:trunkfrom
kowshik:fix_test_KAFKA-10157

Conversation

@kowshik

@kowshik kowshik commented Jun 12, 2020

Copy link
Copy Markdown
Contributor

This PR fixes the cause of failing tests mentioned in the jira:

  • kafka.network.DynamicConnectionQuotaTest
  • kafka.api.CustomQuotaCallbackTest
  • kafka.server.DynamicBrokerReconfigurationTest

Issue:
The call to ChangeNotificationProcessorThread.queue.take() could throw an InterruptedException. While the queue is empty and the thread is blocking on taking an item from the queue, a concurrent call to FinalizedFeatureChangeListener.close() could interrupt the thread and cause an InterruptedException to be raised from queue.take(). In such a case, it is safe to ignore the exception since the thread is being shutdown.
Definitely ignoring the InterruptedException for the above reason was the intent of the code that used the ignoring clause for the same. But it seems unfortunately the ignoring clause does not ignore InterruptedException, so that doesn't work for us. To confirm this theory, I found the following code in scala.util.control.Exception.scala: https://github.com/scala/scala/blob/v2.12.0/src/library/scala/util/control/Exception.scala#L167-L176.

Fix:
The fix in this PR is to just not use the ignoring clause. We rely on existing mechanism in ShutdownableThread that ignores the exception during shutdown.

Test plan:
Ran the unit and integration tests and found that the test failures are gone now.
I will wait for CI to pass before merging this PR.

@kowshik kowshik changed the title KAFKA-10157: Fix broken tests due to FinalizedFeatureChangeListener i… KAFKA-10157: Fix broken tests due to InterruptedException from FinalizedFeatureChangeListener Jun 12, 2020
@kowshik

kowshik commented Jun 12, 2020

Copy link
Copy Markdown
Contributor Author

cc @ijuma @apovzner @junrao @abbccdda for review.

@ijuma

ijuma commented Jun 12, 2020

Copy link
Copy Markdown
Member

ok to test

Comment thread core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala Outdated

@kowshik kowshik left a comment

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.

Thanks for the review @chia7712! I have addressed the comment in 6e94ead8bb505a968385e554e9b6d4dab8d55284.

Comment thread core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala Outdated
@kowshik

kowshik commented Jun 12, 2020

Copy link
Copy Markdown
Contributor Author

@chia7712 Could you please help trigger a CI run?

@chia7712

Copy link
Copy Markdown
Member

retest this please

@kowshik

kowshik commented Jun 12, 2020

Copy link
Copy Markdown
Contributor Author

@chia7712 I think CI is not triggering. I'd appreciate the help if you could trigger it again.

@chia7712

Copy link
Copy Markdown
Member

@kowshik

Is this CI not working for this PR?

https://builds.apache.org/job/kafka-pr-jdk8-scala2.12/2932/console

@chia7712

Copy link
Copy Markdown
Member

CI comes back :)

@junrao junrao left a comment

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.

@kowshik : Thanks for the PR. Just one comment below.

Comment thread core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala Outdated
@kowshik
kowshik force-pushed the fix_test_KAFKA-10157 branch from 6e94ead to 0b296d8 Compare June 12, 2020 17:32

@kowshik kowshik left a comment

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.

@junrao Thanks for the review! I have addressed the comment in 0b296d8.

Comment thread core/src/main/scala/kafka/server/FinalizedFeatureChangeListener.scala Outdated
@junrao

junrao commented Jun 12, 2020

Copy link
Copy Markdown
Contributor

test this please

@junrao

junrao commented Jun 12, 2020

Copy link
Copy Markdown
Contributor

ok to test

@junrao junrao left a comment

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.

@kowshik : Thanks for the PR. LGTM. Waiting for the tests to pass.

@abbccdda abbccdda left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM to unblock the test failure

// a concurrent call to FinalizedFeatureChangeListener.close() could interrupt the thread
// and cause an InterruptedException to be raised from queue.take(). In such a case, it is
// safe to ignore the exception if the thread is being shutdown. We raise the exception
// here again, because, it is ignored by ShutdownableThread if it is shutting down.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: if it is shutting down -> when shutting down.

@apovzner apovzner left a comment

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.

LGTM. Also, I see that PR build does not have the failures that were happening before this PR (reported in KAFKA-10157), i.e., I don't see a failure like "finished with non-zero exit value 1" in console output.

@kowshik

kowshik commented Jun 12, 2020

Copy link
Copy Markdown
Contributor Author

@apovzner Can you go ahead and merge this PR? The latest failures in CI are unrelated.

@junrao
junrao merged commit 3d45e1f into apache:trunk Jun 12, 2020
Kvicii pushed a commit to Kvicii/kafka that referenced this pull request Jun 13, 2020
* 'trunk' of github.com:apache/kafka: (42 commits)
  HOTFIX: Fix compile error in TopicAdminTest (apache#8866)
  KAFKA-10144: clean up corrupted standby tasks before attempting a commit (apache#8849)
  KAFKA-10157: Fix broken tests due to InterruptedException from FinalizedFeatureChangeListener (apache#8857)
  KAFKA-9432: automated protocol for DescribeConfigs (apache#8312)
  KAFKA-10049: Fixed FKJ bug where wrapped serdes are set incorrectly when using default StreamsConfig serdes (apache#8764)
  KAFKA-10027: Implement read path for feature versioning system (KIP-584) (apache#8680)
  KAFKA-10085: correctly compute lag for optimized source changelogs (apache#8787)
  KAFKA-10086: Integration test for ensuring warmups are effective (apache#8818)
  KAFKA-9374: Make connector interactions asynchronous (apache#8069)
  MINOR: reduce sizeInBytes for percentiles metrics (apache#8835)
  KAFKA-10115: Incorporate errors.tolerance with the Errant Record Reporter (apache#8829)
  KAFKA-9216: Enforce that Connect’s internal topics use `compact` cleanup policy (apache#8828)
  KAFKA-9845: Warn users about using config providers with plugin.path property (apache#8455)
  KAFKA-7833: Add missing test (apache#8847)
  KAFKA-9066: Retain metrics for failed tasks (apache#8502)
  KAFKA-9841: Revoke duplicate connectors and tasks when zombie workers return with an outdated assignment (apache#8453)
  KAFKA-9985: Sink connector may exhaust broker when writing in DLQ (apache#8663)
  KAFKA-9441: remove prepareClose() to simplify task management (apache#8833)
  KAFKA-7833: Add Global/StateStore name conflict check (apache#8825)
  KAFKA-9969: Exclude ConnectorClientConfigRequest from class loading isolation (apache#8630)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants