Я хочу закрыть мое приложение с пружинной загрузкой (spring boot v2) с конечной точкой привода.Я успешно включил конечную точку отключения с помощью пружинного привода (см. Application.yml).Я также могу вызвать конечную точку, и spring закрывает контекст приложения (см. Logs и команду curl).
Но почему-то процесс Java не убивается.Я также попытался упаковать свое приложение в Docker-контейнер, чтобы убедиться, что это не локальная проблема установки с Java.Но безуспешно - процесс Java все еще работает.
Приложение запускается в режиме разработки с базой данных H2 и Spring-Data-Jest для эластичного поиска.
application.yml
management:
security:
roles: ADMIN
endpoints:
web:
base-path: /management
exposure:
include: ["configprops", "env", "health", "info", "threaddump", "logfile", "shutdown" ]
endpoint:
health:
show-details: when_authorized
shutdown:
enabled: true
info:
git:
mode: full
health:
mail:
enabled: false # When using the MailService, configure an SMTP server and set this to true
metrics:
enabled: false # http://micrometer.io/ is disabled by default, as we use http://metrics.dropwizard.io/ instead
spring:
autoconfigure:
exclude: org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchAutoConfiguration,org.springframework.boot.autoconfigure.data.elasticsearch.ElasticsearchDataAutoConfiguration
application:
name: AnyWEB
profiles:
# The commented value for `active` can be replaced with valid Spring profiles to load.
# Otherwise, it will be filled in by gradle when building the WAR file
# Either way, it can be overridden by `--spring.profiles.active` value passed in the commandline or `-Dspring.profiles.active` set in `JAVA_OPTS`
active: #spring.profiles.active#
jpa:
open-in-view: false
hibernate:
ddl-auto: none
naming:
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
messages:
basename: i18n/messages
mvc:
favicon:
enabled: false
thymeleaf:
mode: HTML
server:
servlet:
session:
cookie:
http-only: true
info:
# Comma separated list of profiles that will trigger the ribbon to show
display-ribbon-on-profiles: "dev"
jhipster:
async:
core-pool-size: 2
max-pool-size: 50
queue-capacity: 10000
# By default CORS is disabled. Uncomment to enable.
#cors:
#allowed-origins: "*"
#allowed-methods: "*"
#allowed-headers: "*"
#exposed-headers: "Authorization,Link,X-Total-Count"
#allow-credentials: true
#max-age: 1800
mail:
from: AnyWEB@localhost
swagger:
default-include-pattern: /api/.*
title: AnyWEB API
description: AnyWEB API documentation
version: 0.0.1
terms-of-service-url:
contact-name:
contact-url:
contact-email:
license:
license-url:
logging:
file: build/AnyWEB.log
Конечная точка отключения CURL
curl --header "Authorization: Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImF1dGgiOiJST0xFX0FETUlOLFJPTEVfVVNFUiIsImV4cCI6MTUzOTQzNTk0OX0.tlu88esl-PYzdZvdEnlaJJB2Niy4p2AOtHqL5O7tr1C2LDottIZJtZGAi2WLTW9VYKUScY-eDi3P7TxhndS6CA" -X POST 192.168.99.100:8080/management/shutdown
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 35 0 35 0 0 66 0 --:--:-- --:--:-- --:--:-- 66{"message":"Shutting down, bye..."}
ЖУРНАЛЫ при выключении:
Вот полный дамп потока после вызова конечной точки отключения привода
Full thread dump
"XNIO-1 Accept@7046" daemon prio=5 tid=0x17 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked (a sun.nio.ch.WindowsSelectorImpl)
- locked (a java.util.Collections$UnmodifiableSet)
- locked (a sun.nio.ch.Util$2)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:511)
"XNIO-1 I/O-1@7045" daemon prio=5 tid=0x16 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(WindowsSelectorImpl.java:-1)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:296)
at sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:278)
at sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:159)
at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:86)
- locked (a sun.nio.ch.WindowsSelectorImpl)
- locked (a java.util.Collections$UnmodifiableSet)
- locked (a sun.nio.ch.Util$2)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:97)
at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:101)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:511)
"pool-4-thread-1@19750" prio=5 tid=0x3b nid=NA waiting
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Unsafe.java:-1)
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:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"Abandoned connection cleanup thread@6449" daemon prio=5 tid=0x15 nid=NA waiting
java.lang.Thread.State: WAITING
at sun.misc.Unsafe.park(Unsafe.java:-1)
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:1067)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
"MVStore background writer nio:C:/Users/Simon/git/lisaweb/build/h2db/db/lisaweb.mv.db@7366" daemon prio=5 tid=0x19 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at org.h2.mvstore.MVStore$BackgroundWriterThread.run(MVStore.java:2708)
"Finalizer@19938" daemon prio=8 tid=0x3 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:143)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:164)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler@19939" daemon prio=10 tid=0x2 nid=NA waiting
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Object.java:-1)
at java.lang.Object.wait(Object.java:502)
at java.lang.ref.Reference.tryHandlePending(Reference.java:191)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:153)
"DestroyJavaVM@19830" prio=5 tid=0x42 nid=NA runnable
java.lang.Thread.State: RUNNABLE
"Attach Listener@19936" daemon prio=5 tid=0x5 nid=NA runnable
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher@19937" daemon prio=9 tid=0x4 nid=NA runnable
java.lang.Thread.State: RUNNABLE
Обновление: Я настроил производственную среду с запущенным mysql +asticsearchдокер.Я запустил приложение с производственным профилем, но проблема все еще остается.Так что я думаю, что это не проблема с локальным h2 и локальным в экземпляре памяти jestasticsearch.
Любая помощь будет оценена - спасибо