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

[browser][mt] Release all proxies of C# and JS objects #86039

Closed
pavelsavara opened this issue May 10, 2023 · 2 comments · Fixed by #88052
Closed

[browser][mt] Release all proxies of C# and JS objects #86039

pavelsavara opened this issue May 10, 2023 · 2 comments · Fixed by #88052
Assignees
Milestone

Comments

@pavelsavara
Copy link
Member

release all those proxies when we detach the worker.

  • for the proxies of objects, we would reset the GCHandle/JSHandle to -1 and if some stray setTimeout callback uses it, we will throw.
  • for the proxies of functions, mark it disposed and it would throw if you try to call it.
  • for the proxies of Task/Promise
  • same for proxies in the other direction.
  • at the end of detach, we should assert that have empty FinalizationRegistry of that worker.
  • at the end of detach, we should assert that s_csOwnedObjects is empty
  • we need a JS callback or event when a pthread detaches
  • the FinalizationRegistry callback invokes managed code, so we need to check when is the last moment when the thread is still attached enough that we can run some managed code.
@ghost
Copy link

ghost commented May 10, 2023

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

release all those proxies when we detach the worker.

  • for the proxies of objects, we would reset the GCHandle/JSHandle to -1 and if some stray setTimeout callback uses it, we will throw.
  • for the proxies of functions, mark it disposed and it would throw if you try to call it.
  • for the proxies of Task/Promise
  • same for proxies in the other direction.
  • at the end of detach, we should assert that have empty FinalizationRegistry of that worker.
  • at the end of detach, we should assert that s_csOwnedObjects is empty
  • we need a JS callback or event when a pthread detaches
  • the FinalizationRegistry callback invokes managed code, so we need to check when is the last moment when the thread is still attached enough that we can run some managed code.
Author: pavelsavara
Assignees: pavelsavara, lambdageek
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript

Milestone: 8.0.0

@pavelsavara
Copy link
Member Author

Perhaps we could also report the proxies to console #70660 when we do it. So that diligent customers could explicitly dispose them.

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 26, 2023
@ghost ghost added in-pr There is an active PR which will close this issue when it is merged and removed in-pr There is an active PR which will close this issue when it is merged labels Jul 11, 2023
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 24, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Aug 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants