Race-condition when removing instance of WinTUN adapter?

Simon Rozman simon at rozman.si
Wed May 21 08:39:50 UTC 2025


Hi,

> We are receiving variations of the following errors on multiple Windows
> machines from customers. The UUID is what we are setting as the tunnel
> adapter ID.
> 
> ```
> Spawning native process to remove instance Error executing worker
> process: "SWD\WINTUN\{E9245BC1-B8C1-44CA-AB1D-C6AAD4F13B9C}": The system
> cannot find the path specified. (Code 0x00000003) ```
> 
> and
> 
> ```
> Spawning native process to remove instance Failed to create process:
> rundll32
> "C:\Windows\Temp\ab11b60bba2fb3bcc9a355e9e3a89003522ede647bc6c00704e734a
> 8447c1ce5\setupapihost.dll",RemoveInstance "SWD\WINTUN\{E9245BC1-B8C1-
> 44CA-AB1D-C6AAD4F13B9C}": Het systeem kan het opgegeven pad niet vinden.
> (Code 0x00000003) ```
> 
> (Error message here is Dutch because that particular customer is in the
> Netherlands. It means "The system cannot find the path specified")
> 
> From reading the source code at [0], I suspect that this is "only" a
> race condition where the adapter is simply no longer present at the time
> we want to remove it? I am not very well versed at C code which is why I
> figured I'd ask here before attempting to patch the code. Would it make
> sense to add a check for this particular error code and not fail as a
> result, making the function idempotent?

Exactly: failure to remove something that is already removed is not a failure.

I've updated the source code to ignore this error when deleting the adapter instance:
https://git.zx2c4.com/wintun/commit/?id=28627e00f0889f19ecb0abbf013e04bc897ab9f5

Thank you for reporting this.

Best regards,
Simon


More information about the WireGuard mailing list