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 Fray hang when a thread exits but the monitor lock is acquired by… #151

Merged
merged 1 commit into from
Mar 10, 2025

Conversation

aoli-al
Copy link
Member

@aoli-al aoli-al commented Mar 10, 2025

… another thread.

@Copilot Copilot bot review requested due to automatic review settings March 10, 2025 14:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR introduces a new test case and updates test scheduling to verify the fix for a hang that occurred when a thread exits while holding a monitor lock.

  • Add a new test case (ThreadExitDeadlock.java) simulating a potential deadlock scenario.
  • Update the test suite (FrayTestCase.java) to invoke the new test case and change the scheduler from RandomScheduler to POSScheduler.

Reviewed Changes

File Description
integration-test/src/main/java/org/pastalab/fray/test/fail/thread/ThreadExitDeadlock.java Added a test case to simulate the thread exit deadlock scenario.
CHANGELOG.md Updated changelog to include a fix for the monitor lock issue.
integration-test/src/test/java/org/pastalab/fray/test/FrayTestCase.java Modified test to execute the new ThreadExitDeadlock test case and changed scheduler to POSScheduler.

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

integration-test/src/test/java/org/pastalab/fray/test/FrayTestCase.java:94

  • [nitpick] The replacement of RandomScheduler with POSScheduler may affect the test behavior. Consider adding a brief comment or confirming that POSScheduler provides the intended scheduling for this test scenario.
new POSScheduler(),

});
synchronized (t) {
t.start();
latch.await();
Copy link
Preview

Copilot AI Mar 10, 2025

Choose a reason for hiding this comment

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

The latch is never decremented in the thread's runnable, which causes latch.await() to block indefinitely. If this is intended to simulate a deadlock scenario, please add a comment clarifying the purpose; otherwise, consider calling latch.countDown() in the thread.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
Copy link
Member Author

Choose a reason for hiding this comment

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

Hey Copilot, good catch! But this is an intended behavior.

@aoli-al aoli-al merged commit dcebeed into main Mar 10, 2025
1 check passed
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.

1 participant