- Notifications
You must be signed in to change notification settings - Fork 25.6k
Description
Elasticsearch Version
7.17.* 8.*
Installed Plugins
No response
Java Version
bundled
OS Version
Windows
Problem Description
When Elasticsearch runs as a Windows Service, the stop service action hangs indefinitely, when an OIDC realm is configured (doesn't have to be used).
Elasticsearch tries to gracefully terminate all the threads when the JVM is terminated.
That is true on all platforms supported by ES (though this is not a JVM requirement in general).
For a Windows Service deployment, given our configuration of procrun (the code that installs the ES JVM as a Windows Service) the JVM is terminated in a different way (not via System.exit).
The Windows Service stop procedure must necessarily terminate all the non-daemon threads, at which point the JVM will then terminate naturally. Any bug in omitting to terminate non-daemon threads is a serious problem for Windows Service deployments (for other deployment types it is a minor nuisance).
Unfortunately, the OpenIdConnectRealm (more specifically the OpenIdConnectAuthenticator) creates threads for its http client used for backchannel comms, which it does not close because the Realm#close method is never invoked.
Steps to Reproduce
Configure any OIDC realm and install Elasticsearch as a Service on Windows.
The stop service action will hang indefinitely.