-
Notifications
You must be signed in to change notification settings - Fork 492
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
Stop application if CTLR+C is requested early #11036
Stop application if CTLR+C is requested early #11036
Conversation
b387cf1
to
f0deeda
Compare
85c3e81
to
46bba39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixes the issue.
it happens rarely (like 5%) of the time that the terminal hangs (stopping software when GUI is launched)
video
Screencast.from.18-07-2023.09.42.20.webm
other than that it works better, so
ACK
Are you saying that this PR makes the terminal hangs in 5% cases? Or does that happen even on master? |
Correct. I cannot repro the hang on master. |
While testing this PR, I managed to crash Wasabi and got index corruption. I could reproduce it only once though. |
I think you may have hit an issue the filter sync changes that were introduced recently. It's being worked on. My understanding is: This PR attempts to stop initialization of the program which in itself is correct but not all components respond correctly. (No proof, just my gut feeling.) The question is what is better whether to hide the error or rather expose it which would force us to fix it. Personally, I like the later variant more. However, it makes sense to me to tackle #11065 first and then we can re-test this. But it will take time. |
.StartWithClassicDesktopLifetime(app.AppConfig.Arguments); | ||
}); | ||
|
||
if (app.TerminateService.CancellationToken.IsCancellationRequested) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If user requested to stop the application "early", we don't start Avalonia actually.
private CancellationTokenSource TerminationCts { get; } = new(); | ||
|
||
/// <remarks>Assigned once so that there are no issues with <see cref="TerminationCts"/> being disposed.</remarks> | ||
public CancellationToken CancellationToken { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an application-wide cancellation token that denotes that user requested the application to terminate.
@MarnixCroes @ichthus1604 Would you mind testing again? Regarding #11036 (comment), filters are handled differently now so hopefully, that's fixed by now. I have not been able to reproduce that. btw: This is still only a partial fix (90% of cases?). There is still a small time window when this will not work correctly, but to make it work every time, I think we will need Avalonia 11 where there is richer API for "shutdowns" (or some novel idea how to fix it). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw: This is still only a partial fix (90% of cases?). There is still a small time window when this will not work correctly,
sometimes it would hang if I press CTRL C after TorMonitor.MonitorEventAsync (150) Tor circuit was established
.
if that's that time window you mentioned:
tACK aa024d9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't make the process hang, no matter how many times I tried on Win11.
Code LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Tested on Win10 but couldn't repro what happened on linux.
I didn't manage to repro behavior @molnard mentioned on Mac. I know this is unrelated, but it doesn't solve the issue of quitting not working properly during Initial Transaction Processing or Wallet Synchronization as a whole. |
Sorry, I was in the wrong repository. My bad. Testing it again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Contributes to #10814
This is a result of work done earlier (#10929). It's the only way I have found so far to stop the software if CTRL+C is pressed very early in the process of starting the software. Currently, on the master, CTRL+C can be ignored if it is requested "too soon".
It's still not 100 per cent correct but I'm not aware of a better solution at the moment.