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

Remove all kernel32.dll references and debug breakpoints #108647

Merged
merged 13 commits into from
Nov 5, 2024

Conversation

VincentBu
Copy link
Contributor

This pull request aims at:

  1. Removing all kernel32.dll references
  2. Replacing all debug breakpoints with logging
  3. Setting debugBreakOnTestHang to false for all configurations

@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Oct 8, 2024
@VincentBu VincentBu requested a review from mrsharm October 8, 2024 07:46
Copy link
Contributor

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

@Maoni0
Copy link
Member

Maoni0 commented Oct 8, 2024

is the test hang just an artifact of the reporting, ie, if a test runs for a long time RF considers it hung? and is this only during the last phase where RF is trying to exit?

@VincentBu
Copy link
Contributor Author

is the test hang just an artifact of the reporting, ie, if a test runs for a long time RF considers it hung? and is this only during the last phase where RF is trying to exit?

Yes. If there are tests uncompleted after the time limit reached, TestIsHungDebugBreak is called. It will block the thread for further actions (for example, attaching the process with a debugger).
Moko and Andrew suggest me to collect dumps directly then we can analyze them with windbg. This facilitates our work when running tests on Linux.

@@ -79,7 +79,6 @@ private void LogWorker()
}
catch (IOException e)
{
ReliabilityFramework.MyDebugBreak(String.Format("LogWorker IOException:{0}", e.ToString()));
Copy link
Member

Choose a reason for hiding this comment

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

Let's throw the exception here so that we can take a dump

Copy link
Member

Choose a reason for hiding this comment

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

If the debugger break is set to true, we should set a debug break point here and if not, log and throw an exception.

@@ -12,7 +12,7 @@
minimumTests="0"
minMaxTestUseCPUCount="true"
suppressConsoleOutputFromTests="true"
debugBreakOnTestHang="true">
debugBreakOnTestHang="false">
Copy link
Member

Choose a reason for hiding this comment

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

Remove as the default is false. (Same for the other configurations)

@@ -882,20 +839,17 @@ private void TestSetShutdown(int totalTestsToRun)

if (_curTestSet.DebugBreakOnTestHang)
{
TestIsHungDebugBreak();
Console.WriteLine("Test hang.");
Copy link
Member

Choose a reason for hiding this comment

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

This should be via the logger and so should be the case below.

@@ -120,7 +120,6 @@ private void LogWorker()
}
catch (IOException e)
{
ReliabilityFramework.MyDebugBreak(String.Format("LogWorker IOException:{0}", e.ToString()));
Copy link
Member

Choose a reason for hiding this comment

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

We probably want to throw an exception here still after logging?

Copy link
Member

Choose a reason for hiding this comment

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

Same as above: if debugger is present => break else, log and throw an exception.

}
catch (OutOfMemoryException)
{
// hang and let someone debug if we can't even break in...
Thread.CurrentThread.Join();
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.Tests, "Out of memory");
Copy link
Member

Choose a reason for hiding this comment

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

Should we throw here to pick up the dump on the scripts?

}
catch (OutOfMemoryException)
{
// hang and let someone debug if we can't even break in...
Thread.CurrentThread.Join();
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.Tests, "Out of memory");
Copy link
Member

Choose a reason for hiding this comment

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

Same logic here - if debugger present => break.

@@ -780,7 +743,7 @@ private void TestStarter()
Thread.Sleep(250); // give the CPU a bit of a rest if we don't need to start a new test.
if (_curTestSet.DebugBreakOnMissingTest && DateTime.Now.Subtract(_startTime) > minTimeToStartTest)
{
NewTestsNotStartingDebugBreak();
_logger.WriteToInstrumentationLog(_curTestSet, LoggingLevels.TestStarter, String.Format("New tests not starting"));
Copy link
Member

Choose a reason for hiding this comment

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

Add debug break conditional functionality.

//Disk may be full so simply stop logging
if (ReliabilityFramework._debugBreakOnTestHang)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe moving this to it's own method parameterized with its own method e.g., void DebugBreakOrThrowException(string message).

@@ -79,6 +79,23 @@ public interface ISingleReliabilityTest
bool Run(); // returns true on success, false on failure.
}

public class MissingTestException : Exception
Copy link
Member

Choose a reason for hiding this comment

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

Can we mark this as a sealed class?

Copy link
Member

@mrsharm mrsharm left a comment

Choose a reason for hiding this comment

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

LGTM

@cshung cshung merged commit 302e0d4 into dotnet:main Nov 5, 2024
70 checks passed
@VincentBu VincentBu deleted the RemoveAllDebugBreakReference branch November 6, 2024 05:14
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-GC-coreclr community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants