Skip to content

Fix crash when other instance exits. - #1634

Merged
Scott Darnell (aeloros) merged 2 commits into
mainfrom
user/aeloros/wait_crash
Oct 22, 2021
Merged

Scott Darnell (aeloros) merged 2 commits into
mainfrom
user/aeloros/wait_crash

Conversation

@aeloros

@aeloros Scott Darnell (aeloros) commented Oct 21, 2021 •

Copy link
Copy Markdown
Contributor

Symptom:
All instances of an app that call into the AppInstance APIs crash, when one of the participating instances exits.

Cause:
Turns out unique_event_watcher does not support non-event type waitable kernel objects like process handles. This change updates the code to use RegisterWaitForSingleObject instead to create the Wait threadpool thread for cleaning up the shared instance data when a given instance exits.

@ghost ghost added the needs-triage label Oct 21, 2021
@aeloros Scott Darnell (aeloros) added area-Lifecycle Topics related to the AppLifecycle, providing lifecycle management for WindowsAppSDK apps and removed needs-triage labels Oct 21, 2021
{
strong_this->OnInstanceTerminated();
}
uint32_t processId{ static_cast<uint32_t>(reinterpret_cast<size_t>(context)) };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT: const


THROW_IF_FAILED(BootstrapInitialize());

bool isSingleInstanced = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT: bool isSingleInstanced{};

@aeloros

Copy link
Copy Markdown
Contributor Author

/azp run

@aeloros
Scott Darnell (aeloros) enabled auto-merge (squash) October 22, 2021 15:29
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@aeloros
Scott Darnell (aeloros) merged commit 758e068 into main Oct 22, 2021
@aeloros
Scott Darnell (aeloros) deleted the user/aeloros/wait_crash branch October 22, 2021 16:22
Scott Darnell (aeloros) added a commit that referenced this pull request Oct 22, 2021
* Convert to using RegisterWaitForSingleObject since unique_event_watcher doesn't support non-event waitable kernel objects.

* Updated test to exercise multiinstancing management.
Scott Darnell (aeloros) added a commit that referenced this pull request Oct 22, 2021
* Convert to using RegisterWaitForSingleObject since unique_event_watcher doesn't support non-event waitable kernel objects.

* Updated test to exercise multiinstancing management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Lifecycle Topics related to the AppLifecycle, providing lifecycle management for WindowsAppSDK apps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants