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: make chaosSplittingCheckData robust #1110

Merged
merged 4 commits into from
Jun 18, 2024
Merged

Conversation

killme2008
Copy link
Contributor

@killme2008 killme2008 commented Jun 17, 2024

Motivation & Modification

As seen in CI https://github.com/sofastack/sofa-jraft/actions/runs/9543270248/job/26299583757

It failed at:

chaosSplittingTest(com.alipay.sofa.jraft.rhea.chaos.ChaosMemoryLeaderReadTest)  Time elapsed: 2.438 sec  <<< ERROR!
java.util.concurrent.ExecutionException: com.alipay.sofa.jraft.rhea.errors.InvalidRegionVersionException: Invalid region version error (region split or merge happened).
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928)
	at com.alipay.sofa.jraft.rhea.client.FutureHelper.get(FutureHelper.java:46)
	at com.alipay.sofa.jraft.rhea.client.DefaultRheaKVStore.bGet(DefaultRheaKVStore.java:385)
	at com.alipay.sofa.jraft.rhea.chaos.AbstractChaosTest.chaosSplittingCheckData(AbstractChaosTest.java:237)
	at com.alipay.sofa.jraft.rhea.chaos.AbstractChaosTest.chaosSplittingTest(AbstractChaosTest.java:227)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)

Looks like it's an expected error. So just assert the error message when raising exceptions in chaosSplittingCheckData.

Result:

Fixes #.

If there is no issue then describe the changes introduced by this PR.

Summary by CodeRabbit

  • Bug Fixes
    • Improved stability in handling timeouts during peer changes in tests to prevent hanging test cases.

@sofastack-cla sofastack-cla bot added bug Something isn't working cla:yes size/XS labels Jun 17, 2024
Copy link
Contributor

coderabbitai bot commented Jun 17, 2024

Warning

Rate limit exceeded

@killme2008 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 21 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 3ed6dcc and 2245e2b.

Walkthrough

The NodeTest.java file has been updated to include enhanced exception handling in the testChangePeersChaosApplyTasks method. This enhancement involves the addition of a try-catch block around the future.get() calls, enforcing a timeout of 20 seconds and providing appropriate handling for TimeoutException. The restructuring aims to ensure robustness and reliability in handling futures and timeouts during peer change operations.

Changes

File Summary
jraft-core/src/test/.../NodeTest.java Enhanced testChangePeersChaosApplyTasks with try-catch handling around future.get() calls and restructured loop for robust timeout and TimeoutException handling.

Poem

Amidst the code, in tests so bright,
A timeout shield, we set alight. 🌟
With futures called and errors tamed,
Stability and order claimed. 🕰️🔒
In the chaos peers once knew,
Now smoother paths, we pursued. 🚀🐇


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@killme2008 killme2008 requested a review from fengjiachun June 17, 2024 17:40
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8cdde76 and e8cc1c1.

Files selected for processing (1)
  • jraft-rheakv/rheakv-core/src/test/java/com/alipay/sofa/jraft/rhea/chaos/AbstractChaosTest.java (1 hunks)
Files skipped from review due to trivial changes (1)
  • jraft-rheakv/rheakv-core/src/test/java/com/alipay/sofa/jraft/rhea/chaos/AbstractChaosTest.java

@killme2008
Copy link
Contributor Author

A fatal error when testing LogitLogStorage:

>>>>>>>>>>>>>>> Start test method: testInstallLargeSnapshot
Start ensureSame, waitTimes=-1
End ensureSame, waitTimes=-1
Node<10.1.0.100:5004> saved snapshot into /tmp/jraft_test_789104793204/10.1.0.100_5004/snapshot/temp/data
Node<10.1.0.100:5004> saved snapshot into /tmp/jraft_test_789104793204/10.1.0.100_5004/snapshot/temp/data
Node<10.1.0.100:5006> loaded snapshot from /tmp/jraft_test_789104793204/10.1.0.100_5006/snapshot/snapshot_2001/data
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007effd98391ca, pid=20721, tid=0x00007eff3d7ff640
#
# JRE version: OpenJDK Runtime Environment (Zulu 8.78.0.19-CA-linux64) (8.0_412-b08) (build 1.8.0_412-b08)
# Java VM: OpenJDK 64-Bit Server VM (25.412-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x8391ca]3,0001,Start ensureSame\u002C waitTimes=-1\n
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/runner/work/sofa-jraft/sofa-jraft/jraft-extension/java-log-storage-impl/hs_err_pid20721.log
End ensureSame, waitTimes=-1
#
# If you would like to submit a bug report, please visit:
#   http://www.azul.com/support/
#
Aborted (core dumped)

@sofastack-cla sofastack-cla bot added size/S and removed size/XS labels Jun 17, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e8cc1c1 and 3ed6dcc.

Files selected for processing (2)
  • jraft-core/src/test/java/com/alipay/sofa/jraft/core/NodeTest.java (2 hunks)
  • jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/core/NodeTest.java (1 hunks)
Additional comments not posted (2)
jraft-extension/java-log-storage-impl/src/test/java/com/alipay/sofa/jraft/core/NodeTest.java (2)

3417-3419: This method correctly configures the node options to use shared timers, which can be beneficial for performance optimization.


Line range hint 1-3419: The test class is well-structured and covers a wide range of scenarios to ensure the robustness of the raft node functionality.

killme2008 and others added 2 commits June 17, 2024 11:36
…/sofa/jraft/core/NodeTest.java

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Contributor

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

@fengjiachun fengjiachun merged commit b401b94 into master Jun 18, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla:yes size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants