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

switch away from thread abort where we can #336

Merged
merged 6 commits into from
Apr 15, 2024

Conversation

hahn-kev
Copy link
Contributor

@hahn-kev hahn-kev commented Apr 11, 2024

closes #335

while writing my tests I discovered that HgProcessOutputReader throws exceptions if redirects are not setup, so I added a comment about that and removed all the code designed to support optional redirects.

I also had to change the ThreadState checks as the threads go to sleep now while waiting to read from the stream, from what I can tell in my tests this new version works all the same.

There were 2 process streams, one was unused so I removed it.


This change is Reviewable

Copy link

github-actions bot commented Apr 11, 2024

Test Results

       4 files  ±  0     412 suites  +8   2h 45m 48s ⏱️ +44s
   881 tests +  5     858 ✔️ +  5    23 💤 ±0  0 ±0 
4 032 runs  +36  3 898 ✔️ +36  134 💤 ±0  0 ±0 

Results for commit 2350791. ± Comparison against base commit 04e1e28.

♻️ This comment has been updated with latest results.

@jasonleenaylor
Copy link
Contributor

src/ChorusHub/Advertiser.cs line 72 at r2 (raw file):

			}

			if (_cancellationTokenSource.Token.IsCancellationRequested && cancelled)

Would all conditions that cause a ThreadAbortException also set IsCancellationRequested on the token? Or will it not matter under those circumstances?

@hahn-kev
Copy link
Contributor Author

src/ChorusHub/Advertiser.cs line 72 at r2 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…

Would all conditions that cause a ThreadAbortException also set IsCancellationRequested on the token? Or will it not matter under those circumstances?

in theory there won't be anymore ThreadAbortExceptions, but if there was then IsCancellationRequested would probably be false. So this should probably be ||

@hahn-kev
Copy link
Contributor Author

src/ChorusHub/Advertiser.cs line 72 at r2 (raw file):

Previously, hahn-kev (Kevin Hahn) wrote…

in theory there won't be anymore ThreadAbortExceptions, but if there was then IsCancellationRequested would probably be false. So this should probably be ||

on the other hand, should we just always close the client? It seems like it should always have been closed and maybe it was just a mistake that it wasn't?

@jasonleenaylor
Copy link
Contributor

src/ChorusHub/Advertiser.cs line 72 at r2 (raw file):

Previously, hahn-kev (Kevin Hahn) wrote…

on the other hand, should we just always close the client? It seems like it should always have been closed and maybe it was just a mistake that it wasn't?

I was thinking it should probably be an || for safety, or just remove the ThreadAbortException if it could only have been triggered by our code. It looks like the client was only closed on Stop via the Abort before and stop is called in the Dispose method.

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

Reviewed 6 of 8 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @hahn-kev)

@hahn-kev
Copy link
Contributor Author

src/ChorusHub/Advertiser.cs line 72 at r2 (raw file):

Previously, jasonleenaylor (Jason Naylor) wrote…

I was thinking it should probably be an || for safety, or just remove the ThreadAbortException if it could only have been triggered by our code. It looks like the client was only closed on Stop via the Abort before and stop is called in the Dispose method.

alright, I just removed all this and I'm now closing and disposing of the client in Stop. If this class is going to be reused then start needs to be called again, so stop is the logical place to cleanup the client.

Copy link
Contributor

@jasonleenaylor jasonleenaylor left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @hahn-kev)

@hahn-kev hahn-kev enabled auto-merge (squash) April 15, 2024 19:10
@hahn-kev hahn-kev merged commit ccdf57d into master Apr 15, 2024
5 checks passed
@hahn-kev hahn-kev deleted the chore/remove-thread-abort branch April 15, 2024 20:27
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.

dotnet no longer supports thread abort
3 participants