[bug][installer] Installer launched from updater plugin may fails with Failed to kill <APPNAME>. Please close it first then try again
#12309
Labels
Failed to kill <APPNAME>. Please close it first then try again
#12309
Describe the bug
Installer launched from updater plugin may fails with
Failed to kill <APPNAME>. Please close it first then try again
, but it's actually exited already (by updater plugin)This happens relatively rarely but have received reports from several users, and I may experience the problem/
It's hard to reproduce now, but when happens, retrying with updater would likely to cause same problem so some OS internal state is related I feel.
Reproduction
Starting NSIS installer from updater plugin would cause problem, but not always.
Expected behavior
No such error should happens
Full
tauri info
outputStack trace
No response
Additional context
I feel something like TOCTOU problem in nsis-tauri-updater.
It looks
get_processes
(and underlying win32 api?) may returns pid for recently exited process, andkill
doesn't check ifOpenProcess
fails with0x80070057
(E_INVALIDARG
).As far as I tried with win 11,
OpenProcess
will fails withE_INVALIDARG
if the process already exits.https://github.com/tauri-apps/nsis-tauri-utils/blob/14d311b13f598508cfa48fae66db3cfb5a30d3bf/crates/nsis-process/src/lib.rs#L207-L231
https://github.com/tauri-apps/nsis-tauri-utils/blob/14d311b13f598508cfa48fae66db3cfb5a30d3bf/crates/nsis-process/src/lib.rs#L159-L164
For reference:
OpenProcess
,OpenProcess
will fails with0x80070057
(E_INVALIDARG
)OpenProcess
andTerminateProcess
,TerminateProcess
will fails with0x80070005
(E_ACCESSDENIED
)OpenProcess
will fails with0x80070005
(E_ACCESSDENIED
). (I tested with killing cmd.exe running as SYSTEM)The text was updated successfully, but these errors were encountered: