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

[FLINK-17769] [runtime] Fix the order of log events on a task failure #12525

Closed
wants to merge 1 commit into from

Conversation

curcur
Copy link
Contributor

@curcur curcur commented Jun 8, 2020

What is the purpose of the change

When a task failure occurs, the error of disposing of an operator is logged before the real rootcasue is printed, which is confusing.

This fix suppressed exception occurring in disposing of an operator and attached the exception together with the rootcause.

Brief change log

  • change disposeAllOperators(True) to throw suppressed exceptions instead of log the exception error first.

Verifying this change

Unit test: StreamTaskTest.testCleanUpExceptionSuppressing

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? no

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 8, 2020

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit d2c8896 (Mon Jun 08 09:54:27 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented Jun 8, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for the fix @curcur.

I think in its current form the PR has some unintended behavior, please see the comments below.

Besides that,

  1. Can you please add a component to commit message according to guide?
  2. Are you also going to fix logging in Task in this PR (maybe in a separate commit)?

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for the update @cuncur,

I've left some comments.

I also couldn't find the test mentioned in the PR description.

@curcur curcur force-pushed the wrong_order branch 2 times, most recently from 4ef5cb9 to 9048cfd Compare June 15, 2020 08:22
@curcur
Copy link
Contributor Author

curcur commented Jun 15, 2020

I believe I have addressed most of the comments we have discussed on Friday (not necessarily exactly the same way mentioned here, but roughly the idea).

There are two most things left:

  1. whether to unify the disposeAllOperators(true/false) logic
  2. unit tests.

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for the update @curcur .
I have only some minor comments.

I think the only thing after addressing (or discussing) them are the tests.

@curcur curcur force-pushed the wrong_order branch 2 times, most recently from 2276d04 to b397c0b Compare June 17, 2020 05:06
@curcur
Copy link
Contributor Author

curcur commented Jun 17, 2020

I've updated the existing unit test case
StreamTaskTest.testCleanUpExceptionSuppressing

to test the suppressed exception here, which I think it should be enough.

The original exception is ExpectedTestException throw from invoke

The suppressed exception is thrown from disposalAllOperators(), and is matched as well.

Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for the update @curcur,
Production code looks good to me.
I've left some minor comments about the test.

throw ex;
}
Assert.assertTrue(ex.getCause() instanceof ExpectedTestException);
Assert.assertTrue(
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: IDE suggests to replace assertTrue with assertEquals

Copy link
Contributor Author

@curcur curcur Jun 18, 2020

Choose a reason for hiding this comment

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

If you replace the assertTrue with assertEquals as suggested by IDE, it will then ask to simplify the code.

I think assertTrue is better than assertEquals since we can achieve the same purpose with shorter code.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with either option, but just to clarify: do you mean the number of characters in assertEquals?

Copy link
Contributor Author

@curcur curcur Jun 18, 2020

Choose a reason for hiding this comment

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

I mean

Assert.assertTrue(ex.getCause() instanceof ExpectedTestException); vs.
Assert.assertEquals(True, ex.getCause() instanceof ExpectedTestException);

I clicked the little yellow blob on the left top, and that is what the IDE suggesting.

@curcur curcur force-pushed the wrong_order branch 2 times, most recently from 67be651 to 683ce55 Compare June 18, 2020 15:28
Copy link
Contributor

@rkhachatryan rkhachatryan left a comment

Choose a reason for hiding this comment

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

Thanks for updating the PR @curcur!
Looks good to me.

@curcur
Copy link
Contributor Author

curcur commented Jun 19, 2020

Thanks for updating the PR @curcur!
Looks good to me.

Thank you so much @rkhachatryan for reviewing the PR :-) Appreciated!

Copy link
Contributor

@pnowojski pnowojski left a comment

Choose a reason for hiding this comment

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

Thanks for the reviews and fix. It L(almost)GTM % one test issue.

When a task failure occurs, the error of disposing of an operator is logged
before the real rootcasue is printed, which is confusing.

This fix suppressed exception occurring in disposing of an operator and
attached the exception together with the rootcause.
Copy link
Contributor

@pnowojski pnowojski left a comment

Choose a reason for hiding this comment

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

Thanks for the update LGTM :)

@pnowojski pnowojski closed this Jun 22, 2020
@curcur curcur deleted the wrong_order branch July 20, 2020 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants