Skip to content

tell Inno Setup to kill the minidump server process if it failed to exit#10766

Merged
acarl005 merged 4 commits into
masterfrom
andy/inno-setup-kills-minidump-server
May 15, 2026
Merged

tell Inno Setup to kill the minidump server process if it failed to exit#10766
acarl005 merged 4 commits into
masterfrom
andy/inno-setup-kills-minidump-server

Conversation

@acarl005
Copy link
Copy Markdown
Contributor

@acarl005 acarl005 commented May 12, 2026

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.

@acarl005 acarl005 added this to the 2026 Week 20 (May 11 - 15) milestone May 12, 2026
@acarl005 acarl005 requested a review from lucieleblanc May 12, 2026 20:27
@acarl005 acarl005 self-assigned this May 12, 2026
@cla-bot cla-bot Bot added the cla-signed label May 12, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 12, 2026

@acarl005

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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-Process errors, 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

Comment thread script/windows/windows-installer.iss Outdated
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 }"',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] -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.

@acarl005
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 12, 2026

@acarl005

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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_Process filter is quoted incorrectly in the Inno Setup string, so it is likely to look for a process whose Name literally 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

Comment thread script/windows/windows-installer.iss Outdated
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 }"',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] The PascalScript escaping here emits doubled quotes around both WMI string literals (for example 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%''.

@acarl005
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 12, 2026

@acarl005

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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

Comment thread app/src/autoupdate/windows.rs Outdated
let after_marker = &after_failed[marker_pos + EXIT_CODE_MARKER.len()..];
let digit_len = after_marker
.iter()
.take_while(|b| b.is_ascii_digit())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] The installer records $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.

@acarl005
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 13, 2026

@acarl005

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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 like Name='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 from Exception.HResult, which are commonly negative. Those failures will be logged but not emitted as AutoupdateMinidumpCleanupFailed.

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

Comment thread script/windows/windows-installer.iss Outdated
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"',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] This escapes each WQL string quote twice, so PowerShell receives 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.

Comment thread app/src/autoupdate/windows.rs Outdated
let after_marker = &after_failed[marker_pos + EXIT_CODE_MARKER.len()..];
let digit_len = after_marker
.iter()
.take_while(|b| b.is_ascii_digit())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] PowerShell exits with $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.

Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

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

The bot comments about the exception parsing and process name filtering string seem valid.

Comment thread app/src/autoupdate/windows.rs Outdated
Comment on lines +108 to +119
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()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there some existing parsing setup we can use here instead of manually handling all these cases?

@acarl005
Copy link
Copy Markdown
Contributor Author

/oz-review

@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 13, 2026

@acarl005

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 /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

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

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-Process failures. 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"',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ [IMPORTANT] 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@acarl005
Copy link
Copy Markdown
Contributor Author

@lucieleblanc Oops! I should've resolved those before sending to you. Those are fixed now and I think the latest review is acceptable.

@acarl005 acarl005 requested a review from lucieleblanc May 13, 2026 23:32
Copy link
Copy Markdown
Contributor

@lucieleblanc lucieleblanc left a comment

Choose a reason for hiding this comment

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

LGTM!

@acarl005 acarl005 merged commit ed01fe4 into master May 15, 2026
28 checks passed
@acarl005 acarl005 deleted the andy/inno-setup-kills-minidump-server branch May 15, 2026 21:54
lawsmd pushed a commit to lawsmd/cortex that referenced this pull request May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants