Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-1964

Java binding crashes when sessions are closed in a different thread

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.7.0
    • Labels:
      None

      Description

      The documentation for multithreading states that Sessions are allowed to be shared across threads, as long as access is synchronized so that the same handle isn't being operated on by more than one thread at a time. This seems like a useful semantic, so I tried creating a cache for sessions and it is working, except that when I close the session handles at the end of the program, it segfaults instead of closing gracefully. The attached file is a minimal test case that simply creates two sessions and then closes them in the main thread with connection.close().

      I don't fully understand what is going on, but based on googling around, it sounds like the problem is that the JNIEnv is specific to a single thread. The swig binding uses the JNIEnv of the thread that created the Session to close it - I think instead it must be the JNIEnv of the current thread that is doing the close.

        Attachments

        1. Example.java
          0.9 kB
        2. Example2.java
          1 kB

          Issue Links

            Activity

              People

              • Assignee:
                donald.anderson Donald Anderson
                Reporter:
                grogers Greg Rogers
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: