]
David Lloyd commented on WFCORE-3581:
-------------------------------------
The problem is that you cannot react twice. So if a SIGTERM is received and we supported
resume, and the user chooses to resume the server, now the server is in a perpetual state
of having exited; further SIGTERM will be ignored by the JVM, and process-exit processing
will never start again. It would become difficult to kill the server.
SIGTERM cannot be treated the same as the CLI operation due to this basic limitation of
the JVM.
Graceful shutdown via sigterm cannot be resumed
-----------------------------------------------
Key: WFCORE-3581
URL:
https://issues.jboss.org/browse/WFCORE-3581
Project: WildFly Core
Issue Type: Bug
Components: Server
Reporter: Jan Stourac
Assignee: Brian Stansberry
Attachments: long-running-servlet.war
When server is sent SIGTERM signal to perform graceful shutdown just at the moment it is
crunching a long-time running request, it cannot be resumed anymore with the :resume() CLI
operation.
See server output (NOTE: NPE in server log is probably caused by this WFCORE-3572.):
{code}
17:47:30,141 INFO [org.jboss.qa.management.web.resources.HeavyProcessingServlet]
(default task-1) Started request processing
17:47:34,367 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0211: Suspending server with
10000 ms timeout.
17:47:34,368 INFO [org.jboss.as.ejb3] (Thread-2) WFLYEJB0493: EJB subsystem suspension
complete
17:47:36,022 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0212:
Resuming server
17:47:36,023 INFO [org.jboss.as.server] (Thread-2) WFLYSRV0220: Server shutdown has been
requested via an OS signal
17:47:36,034 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 70)
WFLYUT0022: Unregistered web context: '/long-running-servlet' from server
'default-server'
17:47:36,050 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread
1-8) WFLYJCA0010: Unbound data source [java:jboss/datasources/ExampleDS]
17:47:36,055 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0019:
Host default-host stopping
17:47:36,058 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3)
WFLYJCA0019: Stopped Driver service with driver-name = h2
17:47:36,067 ERROR [org.jboss.threads.errors] (management task-1) Thread
Thread[management task-1,5,main] threw an uncaught exception:
java.lang.NullPointerException
at
org.jboss.as.server.mgmt.ManagementWorkerService.stopDone(ManagementWorkerService.java:72)
at org.xnio.XnioWorker$1.run(XnioWorker.java:138)
at
org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1979)
at
org.jboss.threads.EnhancedQueueExecutor.completeTermination(EnhancedQueueExecutor.java:1755)
at
org.jboss.threads.EnhancedQueueExecutor.tryDeallocateThread(EnhancedQueueExecutor.java:1578)
at
org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1393)
at java.lang.Thread.run(Thread.java:748)
17:47:36,070 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 69)
WFLYCLINF0003: Stopped client-mappings cache from ejb container
17:47:36,086 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0008:
Undertow HTTPS listener https suspending
17:47:36,086 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0008:
Undertow HTTP listener default suspending
17:47:36,086 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0007:
Undertow HTTPS listener https stopped, was bound to 127.0.0.1:8443
17:47:36,086 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0007:
Undertow HTTP listener default stopped, was bound to 127.0.0.1:8080
17:47:36,087 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0028:
Stopped deployment long-running-servlet.war (runtime-name: long-running-servlet.war) in
61ms
17:47:36,089 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0004:
Undertow 1.4.22.Final stopping
{code}
This is server output in case that graceful shutdown is called via
:shutdown(timeout=<time>) CLI operation:
{code}
17:46:34,064 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62)
WFLYCLINF0002: Started client-mappings cache from ejb container
17:46:34,184 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 66)
WFLYUT0021: Registered web context: '/long-running-servlet' for server
'default-server'
17:46:34,194 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed
"long-running-servlet.war" (runtime-name :
"long-running-servlet.war")
17:46:34,249 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming
server
17:46:34,251 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management
interface listening on
http://127.0.0.1:9990/management
17:46:34,251 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console
listening on
http://127.0.0.1:9990
17:46:34,251 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full
12.0.0.Alpha1-SNAPSHOT (WildFly Core 4.0.0.Beta1-SNAPSHOT) started in 2915ms - Started 396
of 607 services (333 services are lazy, passive or on-demand)
17:46:36,122 INFO [org.jboss.qa.management.web.resources.HeavyProcessingServlet]
(default task-1) Started request processing
17:46:39,998 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0211:
Suspending server with 10000 ms timeout.
17:46:40,000 INFO [org.jboss.as.ejb3] (management-handler-thread - 1) WFLYEJB0493: EJB
subsystem suspension complete
17:46:42,197 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0212:
Resuming server
{code}