eXist-db / exist

eXist Native XML Database and Application Platform
https://exist-db.org
GNU Lesser General Public License v2.1
429 stars 179 forks source link

[BUG] JmxRemoteTest reveals concurrent/shutdown issues #3510

Open adamretter opened 4 years ago

adamretter commented 4 years ago

Initially discovered in https://github.com/eXist-db/exist/pull/3341


Problem 1 (running single test):

$ mvn clean
$ mvn -Dsurefire.exitTimeout=600 -Dtest=org.exist.management.JmxRemoteTest -DfailIfNoTests=false test

...

[INFO] Running org.exist.management.JmxRemoteTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.601 s - in org.exist.management.JmxRemoteTest

Shows that JmxRemoteTest executes and passes 2 tests quickly, but then the command appears to do nothing for a long period of time. This is due to the timeout above being extended. Whilst waiting for the timeout the jstack for the process reports the following interesting threads:

2020-08-18 16:25:24
Full thread dump OpenJDK 64-Bit Server VM (25.252-b09 mixed mode):

"surefire-forkedjvm-last-ditch-daemon-shutdown-thread-600s" #62 daemon prio=5 os_prio=31 tid=0x00007fddda0ea000 nid=0x950b waiting on condition [0x000070000a4d0000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x000000071ce703b0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

"org.eclipse.jetty.util.RolloverFileOutputStream" #43 daemon prio=5 os_prio=31 tid=0x00007fddc9965800 nid=0x7603 in Object.wait() [0x000070000b809000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x00000005c0e3e688> (a java.util.TaskQueue)
    at java.util.TimerThread.mainLoop(Timer.java:552)
    - locked <0x00000005c0e3e688> (a java.util.TaskQueue)
    at java.util.TimerThread.run(Timer.java:505)

"main" #1 prio=5 os_prio=31 tid=0x00007fddd9808800 nid=0xf03 waiting on condition [0x000070000836a000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000005c009d840> (a java.util.concurrent.Semaphore$NonfairSync)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
    at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
    at org.apache.maven.surefire.booter.ForkedBooter.acquireOnePermit(ForkedBooter.java:485)
    at org.apache.maven.surefire.booter.ForkedBooter.acknowledgedExit(ForkedBooter.java:368)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)

After the command completes, the following log files are available:

exist-core/target/surefire-reports/2020-08-18T16-22-21_644-jvmRun1.dumpstream:

# Created at 2020-08-18T16:22:49.689
[SUREFIRE] std/in stream corrupted
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:214)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at java.io.DataInputStream.readInt(DataInputStream.java:388)
        at org.apache.maven.surefire.booter.MasterProcessCommand.decode(MasterProcessCommand.java:113)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:383)
        at java.lang.Thread.run(Thread.java:748)

exist-core/target/surefire-reports/org.exist.management.JmxRemoteTest.txt:

-------------------------------------------------------------------------------
Test set: org.exist.management.JmxRemoteTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.601 s - in org.exist.management.JmxRemoteTest

Even though all the tests passed, both the large delay until the timeout is met and the 2020-08-18T16-22-21_644-jvmRun1.dumpstream file indicates that the test did not behave correctly. The test should shutdown nicely without needing to have Surefire wait for a long timeout and then kill the process.


Problem 2 (running all tests):

$ mvn clean
$ mvn -Dsurefire.exitTimeout=600 test

...
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 93.16 s - in org.exist.storage.lock.ProtectedModeTest
...

Shows that many tests (including JmxRemoteTest) executed ok, but then the command appears to do nothing for a long period of time. This is due to the timeout above being extended. Whilst waiting for the timeout the jstack for the process reports the following interesting threads:

"surefire-forkedjvm-last-ditch-daemon-shutdown-thread-600s" #94 daemon prio=5 os_prio=31 tid=0x00007fc998d14800 nid=0x9a1f waiting on condition [0x0000700008021000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x000000071abf1618> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
    at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

"org.eclipse.jetty.util.RolloverFileOutputStream" #74 daemon prio=5 os_prio=31 tid=0x00007fc99a975800 nid=0x8303 in Object.wait() [0x000070000945d000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    at java.util.TimerThread.mainLoop(Timer.java:552)
    - locked <0x000000071d213df8> (a java.util.TaskQueue)
    at java.util.TimerThread.run(Timer.java:505)

"pool-2-thread-1" #41 prio=5 os_prio=31 tid=0x00007fc9ab182000 nid=0x9513 waiting on condition [0x0000700008124000]
   java.lang.Thread.State: WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000005c0b1f858> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

"main" #1 prio=5 os_prio=31 tid=0x00007fc999809000 nid=0xd03 waiting on condition [0x0000700005ebb000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for  <0x00000005c001b8c0> (a java.util.concurrent.Semaphore$NonfairSync)
    at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedNanos(AbstractQueuedSynchronizer.java:1037)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1328)
    at java.util.concurrent.Semaphore.tryAcquire(Semaphore.java:409)
    at org.apache.maven.surefire.booter.ForkedBooter.acquireOnePermit(ForkedBooter.java:485)
    at org.apache.maven.surefire.booter.ForkedBooter.acknowledgedExit(ForkedBooter.java:368)
    at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:465)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:451)

After the command completes, the following log files are available:

exist-core/target/surefire-reports/2020-08-18T16-39-44_995-jvmRun6.dumpstream:

# Created at 2020-08-18T16:41:46.415
[SUREFIRE] std/in stream corrupted
java.io.IOException: Stream closed
        at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:214)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
        at java.io.DataInputStream.readInt(DataInputStream.java:388)
        at org.apache.maven.surefire.booter.MasterProcessCommand.decode(MasterProcessCommand.java:113)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:383)
        at java.lang.Thread.run(Thread.java:748)

exist-core/target/surefire-reports/org.exist.management.JmxRemoteTest.txt:

-------------------------------------------------------------------------------
Test set: org.exist.management.JmxRemoteTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 30.899 s - in org.exist.management.JmxRemoteTest

Even though all the tests passed, both the large delay until the timeout is met and the 2020-08-18T16-39-44_995-jvmRun6.dumpstream file indicates that a test did not behave correctly. Each test should shutdown nicely without needing to have Surefire wait for a long timeout and then kill the process.

We can offer further evidence that the underlying issue is likely exhibited via the JmxRemoteTest by adding the line:

<exclude>org.exist.management.JmxRemoteTest</exclude>

to the bottom of maven-surefire-plugin's excludes configuration in exist-core/pom.xml, and then re-running all the tests using the commands given above. When this is done, running the tests exhibits no larger delay (because there is no wait for the timeout), and there are no *.dumpstream files generated.


Problem 3 (running single test / Updated surefire: 3.0.0-M5):

This repeats the process of Problem 1, however the surefire-maven-plugin version in exist-parent/pom.xml is updated from 3.0.0-M4 to 3.0.0-M5. This results in a different set of errors:

$ mvn clean
$ mvn -Dsurefire.exitTimeout=600 -Dtest=org.exist.management.JmxRemoteTest -DfailIfNoTests=false test

...

[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ exist-core ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.exist.management.JmxRemoteTest
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 2.606 s <<< FAILURE! - in org.exist.management.JmxRemoteTest
[ERROR] org.exist.management.JmxRemoteTest.checkBasicRequest  Time elapsed: 0.213 s  <<< ERROR!
org.apache.http.NoHttpResponseException: The target server failed to respond
    at org.exist.management.JmxRemoteTest.lambda$checkBasicRequest$1(JmxRemoteTest.java:95)
    at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
    at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
    at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
    at org.exist.management.JmxRemoteTest.checkBasicRequest(JmxRemoteTest.java:94)

[ERROR] org.exist.management.JmxRemoteTest.checkContent  Time elapsed: 0.002 s  <<< ERROR!
org.apache.http.conn.HttpHostConnectException: Connect to localhost:55296 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
    at org.exist.management.JmxRemoteTest.lambda$checkContent$0(JmxRemoteTest.java:62)
    at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
    at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
    at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
    at org.exist.management.JmxRemoteTest.checkContent(JmxRemoteTest.java:62)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at org.exist.management.JmxRemoteTest.lambda$checkContent$0(JmxRemoteTest.java:62)
    at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
    at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
    at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
    at org.exist.management.JmxRemoteTest.checkContent(JmxRemoteTest.java:62)

[ERROR] org.exist.management.JmxRemoteTest  Time elapsed: 0.003 s  <<< ERROR!
java.lang.IllegalStateException: Shutdown in progress

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   JmxRemoteTest.checkBasicRequest:94->withHttpExecutor:112->withHttpClient:107->lambda$withHttpExecutor$2:114->lambda$checkBasicRequest$1:95 » NoHttpResponse
[ERROR]   JmxRemoteTest.checkContent:62->withHttpExecutor:112->withHttpClient:107->lambda$withHttpExecutor$2:114->lambda$checkContent$0:62 » HttpHostConnect
[ERROR]   JmxRemoteTest » IllegalState Shutdown in progress
[INFO]
[ERROR] Tests run: 3, Failures: 0, Errors: 3, Skipped: 0

...

[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  31.002 s
[INFO] Finished at: 2020-08-18T17:10:32+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project exist-core: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/aretter/tmp-code/exist-for-release/exist-core/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] ExecutionException Error occurred in starting fork, check output in log
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: ExecutionException Error occurred in starting fork, check output in log
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.awaitResultsDone(ForkStarter.java:532)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:405)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:321)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:266)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1314)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:1159)
[ERROR]     at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:932)
[ERROR]     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
[ERROR]     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
[ERROR]     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
[ERROR]     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
[ERROR]     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
[ERROR]     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
[ERROR]     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
[ERROR]     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
[ERROR]     at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.lang.reflect.Method.invoke(Method.java:498)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
[ERROR]     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[ERROR] Caused by: org.apache.maven.surefire.booter.SurefireBooterForkException: Error occurred in starting fork, check output in log
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.fork(ForkStarter.java:662)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter.access$700(ForkStarter.java:121)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:393)
[ERROR]     at org.apache.maven.plugin.surefire.booterclient.ForkStarter$1.call(ForkStarter.java:370)
[ERROR]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[ERROR]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[ERROR]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[ERROR]     at java.lang.Thread.run(Thread.java:748)

After the command completes, the following log files are available: exist-core/target/surefire-reports/2020-08-18T17-10-04_899-jvmRun1.dump:

# Created at 2020-08-18T17:10:32.454
Exiting self fork JVM. Received SHUTDOWN command from Maven shutdown hook.
Thread dump before exiting the process (53531@pomona.local):
"qtp1045731788-59"
   java.lang.Thread.State: RUNNABLE
        at com.sun.jmx.mbeanserver.Repository.retrieve(Repository.java:481)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1088)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBeanInfo(DefaultMBeanServerInterceptor.java:1375)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.getMBeanInfo(JmxMBeanServer.java:920)
        at org.exist.management.client.JMXtoXML.queryMBeans(JMXtoXML.java:363)
        at org.exist.management.client.JMXtoXML.generateXMLReport(JMXtoXML.java:273)
        at org.exist.management.client.JMXServlet.writeXmlData(JMXServlet.java:164)
        at org.exist.management.client.JMXServlet.doGet(JMXServlet.java:118)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1411)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:620)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:160)
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:78)
        at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:51)
        at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:207)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1402)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:767)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
        at org.eclipse.jetty.server.Server.handle(Server.java:501)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
        at org.eclipse.jetty.server.HttpChannel$$Lambda$255/1825487463.dispatch(Unknown Source)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
        at java.lang.Thread.run(Thread.java:748)

...

"surefire-forkedjvm-command-thread"
   java.lang.Thread.State: RUNNABLE
        at sun.management.ThreadImpl.getThreadInfo1(Native Method)
        at sun.management.ThreadImpl.getThreadInfo(ThreadImpl.java:178)
        at org.apache.maven.surefire.booter.ForkedBooter.generateThreadDump(ForkedBooter.java:649)
        at org.apache.maven.surefire.booter.ForkedBooter.access$400(ForkedBooter.java:82)
        at org.apache.maven.surefire.booter.ForkedBooter$4.update(ForkedBooter.java:340)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.callListeners(CommandReader.java:423)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.exitByConfiguration(CommandReader.java:435)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:388)
        at java.lang.Thread.run(Thread.java:748)

"main"
   java.lang.Thread.State: RUNNABLE
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
        at java.net.SocketInputStream.read(SocketInputStream.java:171)
        at java.net.SocketInputStream.read(SocketInputStream.java:141)
        at org.apache.http.impl.io.SessionInputBufferImpl.streamRead(SessionInputBufferImpl.java:137)
        at org.apache.http.impl.io.SessionInputBufferImpl.fillBuffer(SessionInputBufferImpl.java:153)
        at org.apache.http.impl.io.SessionInputBufferImpl.readLine(SessionInputBufferImpl.java:280)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:138)
        at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
        at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
        at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
        at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
        at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
        at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
        at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
        at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186)
        at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
        at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at org.apache.http.client.fluent.Request.internalExecute(Request.java:173)
        at org.apache.http.client.fluent.Executor.execute(Executor.java:262)
        at org.exist.management.JmxRemoteTest.lambda$checkBasicRequest$1(JmxRemoteTest.java:95)
        at org.exist.management.JmxRemoteTest$$Lambda$245/1815025408.apply(Unknown Source)
        at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
        at org.exist.management.JmxRemoteTest$$Lambda$246/3694603.apply(Unknown Source)
        at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
        at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
        at org.exist.management.JmxRemoteTest.checkBasicRequest(JmxRemoteTest.java:94)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
        at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
        at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
        at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
        at org.junit.rules.RunRules.evaluate(RunRules.java:20)
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272)
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:237)
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:158)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548)

exist-core/target/surefire-reports/2020-08-18T17-10-04_899-jvmRun1.dumpstream:

# Created at 2020-08-18T17:19:04.899
TestSet has not finished before stream error has appeared >> initializing exit by non-null configuration: EXIT
java.io.EOFException
        at org.apache.maven.surefire.booter.spi.LegacyMasterProcessChannelDecoder.decode(LegacyMasterProcessChannelDecoder.java:135)
        at org.apache.maven.surefire.booter.CommandReader$CommandRunnable.run(CommandReader.java:343)
        at java.lang.Thread.run(Thread.java:748)

exist-core/target/surefire-reports/org.exist.management.JmxRemoteTest.txt:

-------------------------------------------------------------------------------
Test set: org.exist.management.JmxRemoteTest
-------------------------------------------------------------------------------
Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 2.606 s <<< FAILURE! - in org.exist.management.JmxRemoteTest
org.exist.management.JmxRemoteTest.checkBasicRequest  Time elapsed: 0.213 s  <<< ERROR!
org.apache.http.NoHttpResponseException: The target server failed to respond
        at org.exist.management.JmxRemoteTest.lambda$checkBasicRequest$1(JmxRemoteTest.java:95)
        at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
        at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
        at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
        at org.exist.management.JmxRemoteTest.checkBasicRequest(JmxRemoteTest.java:94)

org.exist.management.JmxRemoteTest.checkContent  Time elapsed: 0.002 s  <<< ERROR!
org.apache.http.conn.HttpHostConnectException: Connect to localhost:55296 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused (Connection refused)
        at org.exist.management.JmxRemoteTest.lambda$checkContent$0(JmxRemoteTest.java:62)
        at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
        at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
        at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
        at org.exist.management.JmxRemoteTest.checkContent(JmxRemoteTest.java:62)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at org.exist.management.JmxRemoteTest.lambda$checkContent$0(JmxRemoteTest.java:62)
        at org.exist.management.JmxRemoteTest.lambda$withHttpExecutor$2(JmxRemoteTest.java:114)
        at org.exist.management.JmxRemoteTest.withHttpClient(JmxRemoteTest.java:107)
        at org.exist.management.JmxRemoteTest.withHttpExecutor(JmxRemoteTest.java:112)
        at org.exist.management.JmxRemoteTest.checkContent(JmxRemoteTest.java:62)

org.exist.management.JmxRemoteTest  Time elapsed: 0.003 s  <<< ERROR!
java.lang.IllegalStateException: Shutdown in progress

The java.lang.IllegalStateException: Shutdown in progress messages seem to be originating from something calling either java.lang.Runtime#addShutdownHook(Thread) or java.lang.Runtime#removeShutdownHook(Thread).

exist-core/target/test-logs-20200818171030221/exist.log:

2020-08-18 17:10:32,252 [main] INFO  (Server.java [doStart]:400) - Started @2572ms
2020-08-18 17:10:32,252 [main] WARN  (JettyStart.java [run]:279) - Could not find IPRangeServlet extension. IPRange will be disabled!
2020-08-18 17:10:32,429 [qtp1045731788-59] WARN  (Descriptor.java [<init>]:102) - Giving up unable to read descriptor file from /Users/aretter/tmp-code/exist-for-release/exist-core/target/test-classes/etc/descriptor.xml
2020-08-18 17:10:32,430 [qtp1045731788-59] WARN  (Descriptor.java [<init>]:118) - Giving up unable to read descriptor.xml file from classloader in package org.exist.http
2020-08-18 17:10:32,437 [qtp1045731788-59] INFO  (JMXServlet.java [obtainTokenFileReference]:268) - Token file:  /var/folders/jp/8gqm072107l_rl1pvbw8rgjh0000gn/T/org.exist.test.ExistWebServer7425333426089439169/jmxservlet.token
2020-08-18 17:10:32,440 [qtp1045731788-59] INFO  (JMXServlet.java [init]:211) - JMXservlet token: fa380573-543e-48a7-b805-73543ef8a724
2020-08-18 17:10:32,456 [global.BrokerPools.ShutdownHook] INFO  (BrokerPools.java [lambda$0]:68) - Executing shutdown thread
2020-08-18 17:10:32,456 [global.BrokerPoolsAndJetty.ShutdownHook] INFO  (BrokerPool.java [shutdown]:1592) - Database is shutting down ...
2020-08-18 17:10:32,461 [JettyShutdownThread] INFO  (AbstractConnector.java [doStop]:381) - Stopped ServerConnector@42b64ab8{HTTP/1.1, (http/1.1)}{0.0.0.0:55296}
2020-08-18 17:10:32,462 [JettyShutdownThread] INFO  (AbstractConnector.java [doStop]:381) - Stopped ServerConnector@716a7124{SSL, (ssl, http/1.1)}{0.0.0.0:58346}
2020-08-18 17:10:32,462 [JettyShutdownThread] INFO  (HouseKeeper.java [stopScavenging]:158) - node0 Stopped scavenging
2020-08-18 17:10:32,493 [qtp1045731788-59] ERROR (JMXServlet.java [writeXmlData]:179) - org.eclipse.jetty.io.EofException
2020-08-18 17:10:32,875 [global.BrokerPoolsAndJetty.ShutdownHook] INFO  (Journal.java [shutdown]:664) - Shutting down Journal with checkpoint...
2020-08-18 17:10:32,875 [global.BrokerPoolsAndJetty.ShutdownHook] INFO  (FileLock.java [release]:188) - Deleting lock file: /var/folders/jp/8gqm072107l_rl1pvbw8rgjh0000gn/T/org.exist.test.ExistWebServer7425333426089439169/journal.lck
2020-08-18 17:10:32,876 [global.BrokerPoolsAndJetty.ShutdownHook] INFO  (FileLock.java [release]:188) - Deleting lock file: /var/folders/jp/8gqm072107l_rl1pvbw8rgjh0000gn/T/org.exist.test.ExistWebServer7425333426089439169/dbx_dir.lck
2020-08-18 17:10:32,878 [global.BrokerPoolsAndJetty.ShutdownHook] INFO  (BrokerPool.java [shutdown]:1710) - shutdown complete !
2020-08-18 17:10:32,880 [JettyShutdownThread] INFO  (ContextHandler.java [doStop]:1099) - Stopped eXist-db Open Source Native XML Database
2020-08-18 17:10:32,880 [JettyShutdownThread] INFO  (ContextHandler.java [doStop]:1099) - Stopped o.e.j.w.WebAppContext@2755d705{eXist-db portal,/,null,UNAVAILABLE}{/Users/aretter/tmp-code/exist-for-release/exist-jetty-config/target/classes/org/exist/jetty/etc/webapps/portal}

exist-core/target/test-logs-20200818171030221/urlrewrite.log:

2020-08-18 17:10:32,494 [qtp1045731788-59] ERROR (XQueryURLRewrite.java [service]:369) - Error while processing /exist/status: Error while serializing result: org.eclipse.jetty.io.EofException
javax.servlet.ServletException: Error while serializing result: org.eclipse.jetty.io.EofException
        at org.exist.management.client.JMXServlet.writeXmlData(JMXServlet.java:180) ~[classes/:?]
        at org.exist.management.client.JMXServlet.doGet(JMXServlet.java:118) ~[classes/:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet-api-3.1.0.jar:3.1.0]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
        at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1411) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:620) ~[jetty-security-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:160) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:78) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.exist.http.urlrewrite.Forward.doRewrite(Forward.java:51) ~[classes/:?]
        at org.exist.http.urlrewrite.XQueryURLRewrite.service(XQueryURLRewrite.java:207) ~[classes/:?]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0]
        at org.eclipse.jetty.servlet.ServletHolder$NotAsyncServlet.service(ServletHolder.java:1402) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:763) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:569) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:578) ~[jetty-security-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1610) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1377) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:507) ~[jetty-servlet-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1580) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1292) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:234) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:767) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.Server.handle(Server.java:501) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273) [jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104) [jetty-io-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) [jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: javax.xml.transform.TransformerException: org.eclipse.jetty.io.EofException
        at org.exist.util.serializer.XMLWriter.characters(XMLWriter.java:365) ~[classes/:?]
        at org.exist.util.serializer.IndentingXMLWriter.characters(IndentingXMLWriter.java:128) ~[classes/:?]
        at org.exist.util.serializer.DOMSerializer.startNode(DOMSerializer.java:155) ~[classes/:?]
        at org.exist.util.serializer.DOMSerializer.serialize(DOMSerializer.java:64) ~[classes/:?]
        at org.exist.management.client.JMXServlet.writeXmlData(JMXServlet.java:177) ~[classes/:?]
        ... 55 more
Caused by: org.eclipse.jetty.io.EofException
        at org.eclipse.jetty.server.HttpConnection$SendCallback.reset(HttpConnection.java:724) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpConnection$SendCallback.access$300(HttpConnection.java:683) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpConnection.send(HttpConnection.java:542) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpChannel.sendResponse(HttpChannel.java:833) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpChannel.write(HttpChannel.java:910) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor$GzipBufferCB.process(GzipHttpOutputInterceptor.java:416) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.util.IteratingCallback.processing(IteratingCallback.java:241) ~[jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.util.IteratingCallback.iterate(IteratingCallback.java:223) ~[jetty-util-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor.gzip(GzipHttpOutputInterceptor.java:138) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor.commit(GzipHttpOutputInterceptor.java:239) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.handler.gzip.GzipHttpOutputInterceptor.write(GzipHttpOutputInterceptor.java:108) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpOutput.channelWrite(HttpOutput.java:284) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpOutput.channelWrite(HttpOutput.java:268) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:833) ~[jetty-server-9.4.31.v20200723.jar:9.4.31.v20200723]
        at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) ~[?:1.8.0_252]
        at sun.nio.cs.StreamEncoder.implWrite(StreamEncoder.java:282) ~[?:1.8.0_252]
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:125) ~[?:1.8.0_252]
        at sun.nio.cs.StreamEncoder.write(StreamEncoder.java:113) ~[?:1.8.0_252]
        at java.io.OutputStreamWriter.write(OutputStreamWriter.java:194) ~[?:1.8.0_252]
        at org.exist.util.serializer.XMLWriter.writeCharSeq(XMLWriter.java:625) ~[classes/:?]
        at org.exist.util.serializer.XMLWriter.writeChars(XMLWriter.java:582) ~[classes/:?]
        at org.exist.util.serializer.XMLWriter.characters(XMLWriter.java:363) ~[classes/:?]
        at org.exist.util.serializer.IndentingXMLWriter.characters(IndentingXMLWriter.java:128) ~[classes/:?]
        at org.exist.util.serializer.DOMSerializer.startNode(DOMSerializer.java:155) ~[classes/:?]
        at org.exist.util.serializer.DOMSerializer.serialize(DOMSerializer.java:64) ~[classes/:?]
        at org.exist.management.client.JMXServlet.writeXmlData(JMXServlet.java:177) ~[classes/:?]
        ... 55 more

Problem 4 (running all tests / Updated surefire: 3.0.0-M5):

This repeats the process of Problem 2, however the surefire-maven-plugin version in exist-parent/pom.xml is updated from 3.0.0-M4 to 3.0.0-M5. This results in a very similar set of errors to Problem 3.


Working Theories

  1. Perhaps there is some concurrency problem with eXist-db JMX code, where some shared-state may not correctly synchronized. The JMX code is quite messy, especially the setup of the MBeans and Remote Server (Servlet).

  2. We add/remove JVM Shutdown Hooks in eXist-db from JettyStart and BrokerPools`. I think that Surefire also makes use of Shutdown hooks, so perhaps we are interfering with those somehow.

    1. We should try and understand the cause of the java.lang.IllegalStateException: Shutdown in progress messages.
adamretter commented 4 years ago

The java.lang.IllegalStateException: Shutdown in progress error comes from JettyStart#shutdown() when it tries to removeShutdownHook.

The stack trace to the JettyStart#shutdown() function looks like:

java.lang.IllegalStateException: Shutdown in progress
        at java.lang.ApplicationShutdownHooks.remove(ApplicationShutdownHooks.java:82) ~[?:1.8.0_252]
        at java.lang.Runtime.removeShutdownHook(Runtime.java:239) ~[?:1.8.0_252]
        at org.exist.jetty.JettyStart.lambda$9(JettyStart.java:537) ~[classes/:?]
        at java.util.Optional.ifPresent(Optional.java:159) [?:1.8.0_252]
        at org.exist.jetty.JettyStart.shutdown(JettyStart.java:535) [classes/:?]
        at org.exist.test.ExistWebServer.after(ExistWebServer.java:148) [classes/:?]
        at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:59) [junit-4.13.jar:4.13]
        at org.junit.rules.RunRules.evaluate(RunRules.java:20) [junit-4.13.jar:4.13]
        at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306) [junit-4.13.jar:4.13]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:413) [junit-4.13.jar:4.13]
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:364) [surefire-junit4-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) [surefire-junit4-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:237) [surefire-junit4-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:158) [surefire-junit4-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:428) [surefire-booter-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) [surefire-booter-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:562) [surefire-booter-3.0.0-M5.jar:3.0.0-M5]
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:548) [surefire-booter-3.0.0-M5.jar:3.0.0-M5]
adamretter commented 4 years ago

It looks like the code in JettyStart#shutdown() should be modified from:

shutdownHookThread.ifPresent(Runtime.getRuntime()::removeShutdownHook);

to:

shutdownHookThread.ifPresent(thread -> {
    try {
        Runtime.getRuntime().removeShutdownHook(thread);
        logger.debug("BrokerPoolsAndJetty.ShutdownHook hook unregistered");
    } catch (final IllegalStateException e) {
        // Shutdown in progress
        logger.warn("Unable to remove BrokerPoolsAndJetty.ShutdownHook hook: " + e.getMessage());
    }
});
adamretter commented 4 years ago

With the above fix in-place, the next step is that we likely need to talk to the Surefire Plugin developers to get some assistance on how to pinpoint where the issue is in eXist-db.

reinhapa commented 4 years ago

When looking into the actual JDK code, it seems that java.lang.IllegalStateException: Shutdown in progress is thrown by the JDK if a shutdown hook is being added or removed when the ApplicationShutdownHooks.runHooks() is being executed. So you need to handle a possible java.lang.IllegalStateException in case of a adding or removing.

I could imagine that the Surefire Plugin forks a new JVM to run the tests in and stops it externally after the time out..

adamretter commented 4 years ago

When looking into the actual JDK code, it seems that java.lang.IllegalStateException: Shutdown in progress is thrown by the JDK if a shutdown hook is being added or removed when the ApplicationShutdownHooks.runHooks() is being executed. So you need to handle a possible java.lang.IllegalStateException in case of a adding or removing.

Thanks @reinhapa I have fixed that part now, however I still have problems with JmxRemoteTest and Surefire together. I will try and update the description by running all the tests again soon...

joewiz commented 3 years ago

@adamretter Reviewing the list of outstanding items during today's Community Call, we wondered: Do you have any updates on this one?

adamretter commented 3 years ago

@joewiz No updates, sorry.