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

Replace Environment.Exit with ProcessExitSource and cancelation token #5624

Merged
merged 4 commits into from
Apr 27, 2023

Conversation

LukaszRozmej
Copy link
Member

Potentially Fixes #5298

Changes

  • Removes all Environment.Exit and replaces them by using wrapped cancellation token source

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Copy link
Contributor

@Scooletz Scooletz left a comment

Choose a reason for hiding this comment

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

One nitpick and one more important comment.

src/Nethermind/Nethermind.Runner/Program.cs Outdated Show resolved Hide resolved
@@ -38,8 +38,11 @@ public static void CancelDisposeAndClear(ref CancellationTokenSource? cancellati
{
source.Cancel();
source.Dispose();
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

A nitpick: the CompareExchange above can be replaced with Exchange as you always get the previous value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well depends, if someone would have swapped it for something else by then, then we could break that logic.

damian-orzechowski and others added 2 commits April 27, 2023 16:46
@LukaszRozmej
Copy link
Member Author

Unfortunately didn't fix:

Test Run Aborted with error System.Exception: One or more errors occurred.
---> System.Exception: Unable to read beyond the end of the stream.
at System.IO.BinaryReader.Read7BitEncodedInt()
at System.IO.BinaryReader.ReadString()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
--- End of inner exception stack trace ---.
Error: Process completed with exit code 1.

@LukaszRozmej LukaszRozmej merged commit b210414 into master Apr 27, 2023
@LukaszRozmej LukaszRozmej deleted the fix/remove-environment-exit branch April 27, 2023 18:13
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.

Occasional problems with CI
4 participants