Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-616

Semaphore released more times than acquired (java.lang.Error thrown on java 7)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.9.0
    • Affects Version/s: 2.7.3
    • Component/s: Connection Management
    • Environment:
      linux 2.6, 3.4
      openjdk7, oracle jdk7 (u2, u4, u5)

      It seems like _waiting semaphore release more times than acquired.

      Java 6 was tolerant to releasing a lot of permits (so it just overflows without any significant promblems). It may hold some threads in temporal starvation (because semapthore will have negative number of permits). But with such error after some time it will return to normal state.

      But Java 7 will throw java.lang.Error in such case.

      There's stack trace:

      java.lang.Error: Maximum permit count exceeded
        at java.util.concurrent.Semaphore$Sync.tryReleaseShared(Semaphore.java:197) [rt.jar:1.7.0_04]
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.releaseShared(AbstractQueuedSynchronizer.java:1340) [rt.jar:1.7.0_04]
        at java.util.concurrent.Semaphore.release(Semaphore.java:431) [rt.jar:1.7.0_04]
        at com.mongodb.util.SimplePool.done(SimplePool.java:129) [mongo-java-driver-2.7.3.jar:]
        at com.mongodb.util.SimplePool.done(SimplePool.java:103) [mongo-java-driver-2.7.3.jar:]
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            grossws gross
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: