Uploaded image for project: 'MINA'
  1. MINA
  2. DIRMINA-1093

Ignore SME just like CNFE while checking deadlock in DefaultIoFuture

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0.17, 2.0.18, 2.0.19
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
    • Environment:
      Applicable to all platforms

      Description

      The problem occurs when we have a security manager enabled with restrictions.

      After writing a request to LdapNetworkConnection, we wait for the completion of the request. For every

      writeFuture.awaitUninterruptibly

      it checks for deadlock DefaultIoFuture#checkDeadLock() which is code that requires security permissions and throws following exception:

      java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "accessClassInPackage.sun.reflect")

      A proposed solution would be to ignore Java security manager exception (SME) similar to Class not found exception(CNFE). For CNFE, we ignore the exception and continue as we are just testing for deadlocks.

      for (StackTraceElement s : stackTrace) {
               try {
                      Class<?> cls = DefaultIoFuture.class.getClassLoader().loadClass(s.getClassName());
                      
                      if (IoProcessor.class.isAssignableFrom(cls)) {
                          throw new IllegalStateException("DEAD LOCK: " + IoFuture.class.getSimpleName()
                                  + ".await() was invoked from an I/O processor thread.  " + "Please use "
                                  + IoFutureListener.class.getSimpleName()
                                  + " or configure a proper thread model alternatively.");
                      }
                  } catch (ClassNotFoundException cnfe) {
                      // Ignore
                  }
              }
      

        Attachments

        1. DIRMINA-1093.patch
          4 kB
          Yogesh Gaikwad

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              bizybot Yogesh Gaikwad
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: