Uh oh!
There was an error while loading. Please reload this page.
[Mono] Implement eager finalization of WeakReference - #76173
Conversation
d156eb3 to
ebaf490CompareUh oh!
There was an error while loading. Please reload this page.
naricc
commented
Sep 26, 2022
I'm not sure I understand what is happening here. What does making finalization eager actually mean for WeakRefs? What is the behavior supposed to be? |
WeakReference types are finalizable types. Weak references could be used in big quantities and that can have bad effects on finalization queue. The eager approach also has some reliability advantages. Since eager finalization happens when managed threads are stopped, there is no chance of getting into races between finalization and concurrent use of the weak references from other threads. CoreCLR had eager finalization of weak references for a long time. NativeAOT has added that recently - #75436 Another advantage is that if Mono implements eager finalization, it would be able to use the shared implementation of |
filipnavara
commented
Sep 26, 2022
Thanks @VSadov for explaining it better than I would 👍 |
lambdageek
left a comment
There was a problem hiding this comment.
lgtm. although i'm not sure we should put weakreference into mono_defaults
Uh oh!
There was an error while loading. Please reload this page.
BrzVlad
commented
Sep 27, 2022
This change could further be improved by avoiding a useless object allocation. In |
@BrzVlad As I understand the suggestion, we need to move the specialcasing of weak references a bit earlier - from Is this the idea? |
BrzVlad
commented
Sep 27, 2022
@VSadov Yes, that is correct |
filipnavara
commented
Sep 29, 2022
Thanks for taking care of the last feedback, @VSadov! |
VSadov
commented
Sep 29, 2022
I assume the change addresses the suggestions and once |
uweigand
commented
Oct 11, 2022
As of this commit, I'm now seeing failures when running the libs.tests suite on s390x (Mono-based runtime): Any suggestions what this could be, or how to further debug? |
BrzVlad
commented
Oct 11, 2022
I remember seeing this assertion locally but I didn't get to investigate it. I'll see if I can repro this week |
filipnavara
commented
Oct 11, 2022
@uweigand Do you have any details about which test is failing? |
uweigand
commented
Oct 11, 2022
It varies, I've seen multiple different tests failing. One that seems to fail most of the time is |
uweigand
commented
Oct 11, 2022
Also interesting is that for some unknown reason, I'm not seeing any of these failures in the CI here: |
BrzVlad
commented
Oct 11, 2022
I can reproduce, will take a look later |
uweigand
commented
Oct 18, 2022
BrzVlad
commented
Oct 19, 2022
filipnavara
commented
Oct 19, 2022
Thanks a lot! |
…otnet#76173)"" This reverts commit f8f013e.
uweigand
commented
Oct 19, 2022
Yes, this has fixed the test suite on s390x. Thanks! |
No description provided.