-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Sync
-
None
Currently, we are leaking HttpEngine from KtorNetworkTransport and various dispatchers when Realms are being closed.
This can cause problems as surfaced here https://github.com/realm/realm-kotlin/issues/733 where the hypothesis is the running dispatchers prevent the JVM from closing.
As discussed here https://github.com/realm/realm-kotlin/pull/817#issue-1220927930, the current approach where these resources are created by Configuration objects and potentially shared between many Realms/App make it impossible to safely stop them.
Most likely we need to refactor these code paths, so the resources are created lazily and owned by each App / Realm, so they can safely be torn down when those classes are closed.