Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NativeEngine contains thread-unsafe logic that causes crashes during fast refresh BabylonReactNative scenarios #634

Closed
chrisfromwork opened this issue Mar 15, 2021 · 4 comments
Assignees
Milestone

Comments

@chrisfromwork
Copy link
Contributor

We have logic in NativeEngine that hands around an allocator that is not valid when NativeEngine is disposed:

arcana::make_task(arcana::threadpool_scheduler, *m_cancellationSource,

This logic does not observe cancellation requests and can generate crashes during fast refresh/NativeEngine teardown

@chrisfromwork
Copy link
Contributor Author

Chatted with @ryantrem offline. Seems like the following is going on:

"this seems related to the conversation we just had.... NativeEngine is owned by the JS side but tries to do work on a thread other than the JS thread, and so NativeEngine can be destructed while those async operations are executing. m_allocator, m_cancellationToken, and m_runtimeScheduler are all not safe to use in this way. Either lifetimes need to be extended or some of this stuff needs to move out of NativeEngine to something longer lived."

@bghgary bghgary self-assigned this Mar 16, 2021
@bghgary bghgary added bug Something isn't working and removed bug Something isn't working labels Mar 16, 2021
@ryantrem
Copy link
Member

This can happen, for example, when an async LoadTexture is in progress and the NativeEngine is disposed (or maybe when bgfx is shutdown via Graphics::DisableRendering).

@syntheticmagus
Copy link
Contributor

Affected by microsoft/arcana.cpp#36.

@bghgary
Copy link
Contributor

bghgary commented Sep 9, 2024

Closing in favor of #1420.

@bghgary bghgary closed this as completed Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants