tell Inno Setup to kill the minidump server process if it failed to exit#10766
Conversation
|
I'm starting a first review of this pull request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Windows installer fallback that attempts to stop orphaned minidump-server processes after Warp exits, plus telemetry for logged cleanup failures.
Concerns
- The PowerShell cleanup command suppresses
Stop-Processerrors, so failures to terminate the minidump server can still return exit code 0 and skip the new failure log/telemetry. - No security findings.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| which causes the file-copy step to fail with "Access is denied". | ||
| We identify it by the "minidump-server" argument in its command line. } | ||
| Exec('powershell.exe', | ||
| '-NoProfile -NoLogo -Command "Get-CimInstance Win32_Process -Filter \"Name=''''{#MyAppExeName}'''' and CommandLine like ''''%minidump-server%''''\" | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"', |
There was a problem hiding this comment.
-ErrorAction SilentlyContinue suppresses Stop-Process failures, so PowerShell can exit 0 even when the process was not killed and the new telemetry on line 225 will not fire; make stop failures terminating or verify no matching process remains before returning success.
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Windows installer fallback that attempts to stop orphaned minidump-server processes after Warp exits, plus telemetry for non-zero cleanup exit codes.
Concerns
- The PowerShell
Win32_Processfilter is quoted incorrectly in the Inno Setup string, so it is likely to look for a process whoseNameliterally includes quotes instead of matching{#MyAppExeName}. That would make the new fail-safe a no-op while still allowing the installer to continue.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| which causes the file-copy step to fail with "Access is denied". | ||
| We identify it by the "minidump-server" argument in its command line. } | ||
| Exec('powershell.exe', | ||
| '-NoProfile -NoLogo -Command "Get-CimInstance Win32_Process -Filter \"Name=''''{#MyAppExeName}'''' and CommandLine like ''''%minidump-server%''''\" | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }"', |
There was a problem hiding this comment.
Name=''warp.exe''), so the CIM filter will not match the process; use a single escaped quote on each side of the literal, e.g. Name=''{#MyAppExeName}'' and CommandLine like ''%minidump-server%''.
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Windows installer fallback that stops orphaned minidump-server processes after Warp exits, plus telemetry that reports when that fallback fails.
Concerns
- The new telemetry parser misses signed exit codes even though the installer can log signed HRESULT-style values from PowerShell failure paths.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| let after_marker = &after_failed[marker_pos + EXIT_CODE_MARKER.len()..]; | ||
| let digit_len = after_marker | ||
| .iter() | ||
| .take_while(|b| b.is_ascii_digit()) |
There was a problem hiding this comment.
$e[0].Exception.HResult, which is commonly a signed negative value; because this parser only consumes ASCII digits, log lines such as exit code: -214... return None and suppress the new failure telemetry. Accept an optional leading - or normalize the logged value before parsing.
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Windows installer fallback that tries to stop orphaned minidump-server processes after Warp exits, plus telemetry that reports cleanup failures from the next app launch.
Concerns
- The PowerShell WQL filter is quoted with doubled single quotes, so the runtime filter becomes
Name=''warp.exe'' ...instead of valid WQL string literals likeName='warp.exe'. That can make the cleanup command fail before it ever finds or stops the minidump server. - The telemetry parser only consumes ASCII digits after
exit code:, but the PowerShell command logs HRESULT-style failures fromException.HResult, which are commonly negative. Those failures will be logged but not emitted asAutoupdateMinidumpCleanupFailed.
Verdict
Found: 0 critical, 2 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| which causes the file-copy step to fail with "Access is denied". | ||
| We identify it by the "minidump-server" argument in its command line. } | ||
| Exec('powershell.exe', | ||
| '-NoProfile -NoLogo -Command "$stopError = 0; Get-CimInstance Win32_Process -Filter \"Name=''''{#MyAppExeName}'''' and CommandLine like ''''%minidump-server%''''\" | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorVariable e -ErrorAction SilentlyContinue; if ($e) { $stopError = $e[0].Exception.HResult } }; exit $stopError"', |
There was a problem hiding this comment.
Name=''warp.exe''/like ''%minidump-server%''; use one escaped Inno quote per WQL quote (Name=''{#MyAppExeName}'' ...) so the filter is valid and the cleanup can find the process.
| let after_marker = &after_failed[marker_pos + EXIT_CODE_MARKER.len()..]; | ||
| let digit_len = after_marker | ||
| .iter() | ||
| .take_while(|b| b.is_ascii_digit()) |
There was a problem hiding this comment.
$e[0].Exception.HResult, which is often negative; this parser accepts only digits, so logs like exit code: -214... return None and the new telemetry never fires.
lucieleblanc
left a comment
There was a problem hiding this comment.
The bot comments about the exception parsing and process name filtering string seem valid.
| let failed_pos = memchr::memmem::find(contents_lowercase, FAILED_MARKER)?; | ||
| let after_failed = &contents_lowercase[failed_pos..]; | ||
| let marker_pos = memchr::memmem::find(after_failed, EXIT_CODE_MARKER)?; | ||
| let after_marker = &after_failed[marker_pos + EXIT_CODE_MARKER.len()..]; | ||
| let digit_len = after_marker | ||
| .iter() | ||
| .take_while(|b| b.is_ascii_digit()) | ||
| .count(); | ||
| std::str::from_utf8(&after_marker[..digit_len]) | ||
| .ok()? | ||
| .parse() | ||
| .ok() |
There was a problem hiding this comment.
Is there some existing parsing setup we can use here instead of manually handling all these cases?
|
/oz-review |
|
I'm re-reviewing this pull request in response to a review request. You can view the conversation on Warp. I completed the review and no human review was requested for this pull request. Comment Powered by Oz |
There was a problem hiding this comment.
Overview
This PR adds a Windows installer fail-safe that stops lingering minidump-server processes after Warp exits and reports a new telemetry event when that cleanup fails.
Concerns
- The PowerShell cleanup command only records
Stop-Processfailures. If the CIM query itself fails or the filter cannot be evaluated, the command exits successfully, so Inno skips the failure log and the new telemetry never fires while the process may still keep the executable locked.
Verdict
Found: 0 critical, 1 important, 0 suggestions
Request changes
Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).
Powered by Oz
| which causes the file-copy step to fail with "Access is denied". | ||
| We identify it by the "minidump-server" argument in its command line. } | ||
| Exec('powershell.exe', | ||
| '-NoProfile -NoLogo -Command "$stopError = 0; Get-CimInstance Win32_Process -Filter \"Name=''{#MyAppExeName}'' and CommandLine like ''%minidump-server%''\" | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorVariable e -ErrorAction SilentlyContinue; if ($e) { $stopError = $e[0].Exception.HResult } }; exit $stopError"', |
There was a problem hiding this comment.
Get-CimInstance errors are not handled here, so a WMI/CIM/query failure exits with $stopError = 0, skips the failure log, and prevents the new telemetry from firing; make the query use -ErrorAction Stop and return a non-zero code from catch.
There was a problem hiding this comment.
I think that's ok. Since Get-CimInstance is read-only, it's much less risk of errors, e.g. access denied, compared to Stop-Process.
|
@lucieleblanc Oops! I should've resolved those before sending to you. Those are fixed now and I think the latest review is acceptable. |
Description
This PR is to help with Windows auto-update failures. Specifically, we are getting blocked updates due to the minidump server not exiting.
This is a follow-up to #10528.
As of that PR, the minidump server should exit on its own. However, if for some that fails, we add a fail-safe into inno setup to close this process by force.
I've also added the appropriate telemetry for when this fail-safe fails.
Linked Issue
This PR also helps with #10202. Master issue is #10044
Testing
I ran the powershell command manually in a terminal session to verify that it kills the minidump server as intended.