realm-kotlin icon indicating copy to clipboard operation
realm-kotlin copied to clipboard

Users must be able to cleanup internal HttpEngine and Dispachers

Open cmelchior opened this issue 3 years ago • 0 comments

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.

cmelchior avatar Apr 29 '22 14:04 cmelchior