Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8219658

Deadlock in sun.security.ssl.SSLSocketImpl

    Details

    • Subcomponent:
    • Introduced In Build:
      b25
    • Introduced In Version:
      12
    • Resolved In Build:
      b11
    • CPU:
      x86_64
    • OS:
      linux

      Backports

        Description

        ADDITIONAL SYSTEM INFORMATION :
        OS: Linux 64-bit
        Linux Kernel: 4.20.10-200.fc29.x86_64
        ---
        openjdk version "12" 2019-03-19
        OpenJDK Runtime Environment (build 12+33)
        OpenJDK 64-Bit Server VM (build 12+33, mixed mode, sharing)

        A DESCRIPTION OF THE PROBLEM :
        I was analyzing last remaining WildFly failures against JDK 12 RC and I identified one SSL deadlock we are observing in our test suite.
        For some reason thread dump on JDK12 didn't work for me because of some weird maven surefire bug.
        In order to identify the root cause of JVM freeze quickly I decided to debug it manually and use debug logs from custom OpenJDK local build.
        The issue I identified was introduced in sun.security.ssl.SSLSocketImpl via this commit:

        https://github.com/openjdk/jdk/commit/db04b02ec3831f97f2b093c80cde363fd3314af9

        To identify the root cause of failure we are observing I used this custom branch built on top of JDK 12 build 33:

        https://github.com/ropalka/jdk/commits/ssl-deadlock-analysis

        This custom branch helped me to produce debug log (I'm attaching - openjdk.debug) where I discovered this SSL issue.
        In the end of that log you can see that in some usecases SSLSocketImpl$AppInputStream.read()
        method may hold inner class intrinsic lock when SSLSocketImpl$AppInputStream.deplete() method is being called
        and thread invoking that deplete() method will never succeed with inner class intrinsic lock acquisition.

        When I remove the deplete() method synchronization everything works for me.
        Here's my proposal fix of this issue addressing JDK13 upstream:

        https://github.com/ropalka/jdk/commit/d1bbfd126e9bde9d3db0b8b73ee1c60ea93b1dc9

        It would be great if that issue could be backported into JDK12 RC too.

        REGRESSION : Last worked in version 12

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        git clone https://github.com/wildfly/wildfly-core
        cd wildfly-core
        mvn clean install -DallTests -DskipTests
        export JAVA_HOME=$ORACLE_JDK12
        export PATH=$JAVA_HOME/bin:$PATH
        cd testsuite/manualmode
        mvn clean test -Dtest=**/AuditLogBootingSyslogTest

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Test passes
        ACTUAL -
        Test always deadlocks

        FREQUENCY : always


          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  xuelei Xue-Lei Fan
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: