Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2102

ServletPrintWriterDelegate throws exception using OpenJDK 19 EA

    XMLWordPrintable

Details

    • Hide

      In wildfly:

      export JAVA_HOME=/home/rmartinc/apps/jdk-17
      cd testsuite/integration/manualmode
      mvn test -Dtest=org.wildfly.test.manual.elytron.seccontext.AuthenticationForwardingSFSFTestCase#testServletFormEntryFirstInsufficientRoles
      
      Show
      In wildfly: export JAVA_HOME=/home/rmartinc/apps/jdk-17 cd testsuite/integration/manualmode mvn test -Dtest=org.wildfly.test.manual.elytron.seccontext.AuthenticationForwardingSFSFTestCase #testServletFormEntryFirstInsufficientRoles

    Description

      In WFLY-16461 was detected that two tests failed using OpenJDK 19 EA. Finally it seems that the issue is in undertow. The tests do something like the following:

      final PrintWriter writer = response.getWriter();
      try {
          ...
      } catch (Exception e) {
          e.printStackTrace(writer);
      }
      

      In JDK-19 this commit changed how the PrintWriter synchronizes the operation. Now the internal lock inside the PrintWriter is managed. The ServletPrintWriterDelegate uses the unsafe to create the instance and therefore the lock is not initialized. The final exception is the following:

      ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /entry-servlet-form/EntryServlet: java.lang.NullPointerException: Cannot enter synchronized block because "lock" is null
              at java.base/java.lang.Throwable.printStackTrace(Throwable.java:672)
              at java.base/java.lang.Throwable.printStackTrace(Throwable.java:749)
              at deployment.entry-servlet-form.war//org.wildfly.test.manual.elytron.seccontext.EntryServlet.doGet(EntryServlet.java:82)
              at javax.servlet.api@2.0.0.Final//javax.servlet.http.HttpServlet.service(HttpServlet.java:503)
              at javax.servlet.api@2.0.0.Final//javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
              at io.undertow.servlet@2.2.17.Final//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
              ...
      

      That class should to initialize the lock in order to be used, for example in the printStackTrace method of a Exception.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-rmartinc Ricardo Martin Camarero
              rhn-support-rmartinc Ricardo Martin Camarero
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: