2 Replies Latest reply: Mar 29, 2012 4:44 AM by 805968 RSS

    Unclosed cursors problem

    805968
      Hi, I have run into a problem while closing an environment. While closing an entity store, I get java.lang.IllegalStateException, that there are cursors open. I do not use any cursors with that entity store, only entity indexes from a secondary index like this:

      EntityIndex<IndexClass, DataClass> subIndex = cookieIndex.subIndex(currentIndexItem);

      I also insert some items by calling primaryKey.putNoOverwrite() and that's about it.

      Still when calling EntityStore.close(), the result is this:

      java.lang.IllegalStateException: Database still has 6 open cursors while trying to close.
      at com.sleepycat.je.Database.closeInternal(Database.java:503)
      at com.sleepycat.je.Database.close(Database.java:348)
      at com.sleepycat.je.SecondaryDatabase.close(SecondaryDatabase.java:333)
      at com.sleepycat.persist.impl.Store.closeDb(Store.java:1540)
      at com.sleepycat.persist.impl.Store.close(Store.java:1133)
      at com.sleepycat.persist.EntityStore.close(EntityStore.java:656)
      ...

      Any thoughts?
        • 1. Re: Unclosed cursors problem
          Greybird-Oracle
          Hi,

          Are you sure you're not calling methods that open cursors, such as the entities() or keys() methods?

          You may not be aware that these methods open a cursor, which must be closed.

          --mark                                                                                                                                                                                                                                                                                                                                                                                                           
          • 2. Re: Unclosed cursors problem
            805968
            Thank you. There was a call for EntityIndex.entities(), but cursor object was unnamed, and I have failed to spot it. Since I closed it, the error is gone.

            Peter