Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-1523 Review and fix tests that keep failing
  3. UNDERTOW-2400

ResponseWriterTestCase fails because ServletinputStream is closed before read

XMLWordPrintable

      The test is resulting in a NPE on MacOS:

      Error:  testAsyncRespondBeforeRead(io.undertow.servlet.test.response.writer.ResponseWriterTestCase)  Time elapsed: 113.969 s  <<< ERROR!
      java.lang.NullPointerException
      	at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:202)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:176)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:162)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:153)
      	at jakarta.servlet.ServletInputStream.readLine(ServletInputStream.java:81)
      	at io.undertow.servlet.test.response.writer.AsyncResponseWriterOnPostServlet.lambda$doPost$0(AsyncResponseWriterOnPostServlet.java:48)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      

      If the NPE is fixed, we get to see the following error:

      java.io.IOException: UT010029: Stream is closed
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:168)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:162)
      	at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:153)
      	at jakarta.servlet.ServletInputStream.readLine(ServletInputStream.java:81)
      	at io.undertow.servlet.test.response.writer.AsyncResponseWriterOnPostServlet.lambda$doPost$0(AsyncResponseWriterOnPostServlet.java:48)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      

      The test is taking a long time to run, not sure if something is timing out, or just a race condition that is causing the buffer to be closed before finishing reads.
      The failure happens with both ResponseWriterTestCase.testAsyncRespondBeforeRead and ResponseWriterTestCase.testRespondBeforeRead

            flaviarnn Flavia Rainone
            flaviarnn Flavia Rainone
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: