Uploaded image for project: 'Realm Kotlin'
  1. Realm Kotlin
  2. RKOTLIN-459

Investigate if Realm.close actually closes all ressources correctly.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Local
    • None

      Adding JMH to the project and running it resulted in an error like the below, also after calling Realm.close():

      <JMH had finished, but forked VM did not exit, are there stray running threads? Waiting 24 seconds more...>
      
      Non-finished threads:
      
      Thread[Thread-3,5,main]
      
      Thread[DestroyJavaVM,5,main]
      
      Thread[pool-3-thread-1,5,main]
        at java.base@11.0.10/jdk.internal.misc.Unsafe.park(Native Method)
        at java.base@11.0.10/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
        at java.base@11.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
        at java.base@11.0.10/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base@11.0.10/java.lang.Thread.run(Thread.java:834)
      
      Thread[pool-2-thread-1,5,main]
        at java.base@11.0.10/jdk.internal.misc.Unsafe.park(Native Method)
        at java.base@11.0.10/java.util.concurrent.locks.LockSupport.park(LockSupport.java:194)
        at java.base@11.0.10/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2081)
        at java.base@11.0.10/java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:433)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1054)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1114)
        at java.base@11.0.10/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base@11.0.10/java.lang.Thread.run(Thread.java:834)
      

      This could indicate that we do not close all threads correctly and should be investigated. It could also just be some internal coroutine or JMH artifact we have no control over.

            Assignee:
            christian.melchior@mongodb.com Christian Melchior (Inactive)
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: