Skip to content

AppInstance redirection has potential to hang forever #6521

@benstevens48

Description

@benstevens48

Due to lack of full support for CommandLineActivatedEventArgs - #6431 - I've been augmenting app instance redirection with my own version for that case. One thing I've noticed in examining the code is that it's possible for an instance to hang indefinitely if the instance it's redirecting to is in the process of shutting down. It would be quite easy to mitigate against this.

In this file https://github.com/microsoft/WindowsAppSDK/blob/main/dev/AppLifecycle/AppInstance.cpp, all you would need to do is signal the cleanupEvent (if it exists) in the onInstanceTerminated handler, and also check that the process is still open just after creating the cleanupEvent (else fail). In an ideal world you might also communicate the error to the waiting process (I guess you might need a second event to signal the error or use a memory mapped file), but in my opinion it's probably better for the waiting process to carry on as normal (usually just exit) rather than hang indefinitely in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-LifecycleTopics related to the AppLifecycle, providing lifecycle management for WindowsAppSDK appsneeds-triage

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions