Open marcus-bcl opened 4 years ago
I'm having the same issue when using saveConfigOnStart. PWM restarts itself 3 times and then starts looping on:
2020-07-14T18:00:35Z, ERROR, filter.RequestInitializationFilter, error while trying to detect application status: 5053 ERROR_APP_UNAVAILABLE (unable to load the context manager from servlet context)
2020-07-14T18:00:35Z, WARN , http.HttpEventManager, error during sessionCreated event: 5053 ERROR_APP_UNAVAILABLE (unable to load the context manager from servlet context)
Restarting tomcat seems to resolve the issue but that's a workaround that might not work in some contexts.
Description When enabling the 'saveConfigOnStart' option in PwmConfiguration.xml, the application intermittently fails to start after deploying to Tomcat. The error message displayed is:
To Reproduce Steps to reproduce the behavior:
Create a simple PwmConfiguration.xml:
Create a Dockerfile to deploy the app+config to Tomcat:
Build and run the container
docker run $(docker build -q .)
Intermittently the following error occurs and PWM fails to start:
Expected behavior The configuration should be saved with the encrypted security_key, and the application should startup successfully.
Additional context From having a quick look in the code, I believe this is a timing issue. Occasionally the application is restarted too quickly after saving the config, causing the scheduling of the SilentPropertiesFileWatcher to fail with a RejectedExecutionException - which in turn prevents the ContextManager from being stored in the ServletContext. If this is the case, then the relevant code is in
password.pwm.http.ContextManager::initialize
: https://github.com/pwm-project/pwm/blob/db1407912c86601068662b91caebd51f6266a0e3/server/src/main/java/password/pwm/http/ContextManager.java#L301-L304I understand that the 'saveConfigOnStart' option is to be removed in 2.0.0, however the silent.properties method that replaces it does not fit our use case as it only allows configuration of a small subset of options. As v1.9.1 is the latest release version, I hope this can be fixed in a v1.9.2 release.
Let me know if you need any more information.