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

Fix ConcurrentModification exception in Workflow Garbage Collection #741

Merged
merged 4 commits into from
Feb 12, 2020

Conversation

alirezazamani
Copy link

@alirezazamani alirezazamani commented Feb 10, 2020

Issues

Description

  • Here are some details about my PR, including screenshots of any UI changes:
    In workflow Garbage collection, there is possibility that we see ConcurrentMod exception
    while looping through the contexts. The reason behind this exception is that the contexts can be modified using other thread (i.e. controller's main thread or other Garbage Collection threads). This commit fixes this issue by first making a copy of the contexts and then leveraging try catch to avoid such exceptions.

  • The following is the result of the "mvn test" command on the appropriate module:

[ERROR] Tests run: 1083, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 4,194.441 s <<< FAILURE! - in TestSuite
[ERROR] testSubscribeDataChange(org.apache.helix.manager.zk.TestZKWatch) Time elapsed: 0.023 s <<< FAILURE!
java.lang.AssertionError: expected:<0> but was:<1>
at org.apache.helix.manager.zk.TestZKWatch.testSubscribeDataChange(TestZKWatch.java:81)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TestZKWatch.testSubscribeDataChange:81 expected:<0> but was:<1>
[INFO]
[ERROR] Tests run: 1083, Failures: 1, Errors: 0, Skipped: 2
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:09 h
[INFO] Finished at: 2020-02-10T13:27:31-08:00
[INFO] ------------------------------------------------------------------------

mvn test -Dtest="TestZKWatch" result:
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.918 s - in org.apache.helix.manager.zk.TestZKWatch
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.069 s
[INFO] Finished at: 2020-02-10T13:27:54-08:00
[INFO] ------------------------------------------------------------------------

Commits

  • My commits all reference appropriate Apache Helix GitHub issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Code Quality

  • My diff has been formatted using helix-style.xml

In workflow Garbage collection, there is possbility that we see ConcurrentMod exception
while looping through the context. This commit fixes this issue.
@narendly narendly changed the title Fix the possibile ConcurrentMod exception in Workflow Garbage Collection Fix ConcurrentModification exception in Workflow Garbage Collection Feb 11, 2020
Copy link
Contributor

@narendly narendly left a comment

Choose a reason for hiding this comment

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

Thank you!

@alirezazamani
Copy link
Author

This PR is ready to be merged, approved by @narendly.

Final commit message:
Title:
Fix ConcurrentModification exception in Workflow Garbage Collection

Body:
In workflow Garbage collection, there is possibility that we encounter
ConcurrentMod exception while looping through the workflow contexts.
This commit fixes this issue by looping through a deep copy of the
contexts list.

@narendly narendly merged commit 12f11a3 into apache:master Feb 12, 2020
narendly pushed a commit to narendly/helix that referenced this pull request Feb 20, 2020
…pache#741)

In workflow Garbage collection, there is possibility that we encounter
ConcurrentMod exception while looping through the workflow contexts.
This commit fixes this issue by adding a try-catch.
mgao0 pushed a commit to mgao0/helix that referenced this pull request Mar 6, 2020
…pache#741)

In workflow Garbage collection, there is possibility that we encounter
ConcurrentMod exception while looping through the workflow contexts.
This commit fixes this issue by adding a try-catch.
@alirezazamani alirezazamani deleted the concurrentMod branch June 8, 2020 21:11
huizhilu pushed a commit to huizhilu/helix that referenced this pull request Aug 16, 2020
…pache#741)

In workflow Garbage collection, there is possibility that we encounter
ConcurrentMod exception while looping through the workflow contexts.
This commit fixes this issue by adding a try-catch.
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.

ConcurrentModificationException for the TaskGarbageCollectionStage
3 participants