Skip to content

Fix shutdown cleanup: stop Tomcat before MariaDB, disable reloadable#115

Merged
dkayiwa merged 1 commit intoopenmrs-emr3from
fix-shutdown-cleanup
Feb 28, 2026
Merged

Fix shutdown cleanup: stop Tomcat before MariaDB, disable reloadable#115
dkayiwa merged 1 commit intoopenmrs-emr3from
fix-shutdown-cleanup

Conversation

@dkayiwa
Copy link
Member

@dkayiwa dkayiwa commented Feb 28, 2026

Problem

During shutdown, errors like NoSuchFileException: .../WEB-INF/lib/httpcore-nio-4.4.13.jar occur because:

  1. Shutdown hook stops MariaDB before Tomcat — the database is killed while Tomcat is still running context cleanup listeners (Listener.contextDestroyed()), which try to open Hibernate sessions and load classes
  2. reloadable=true causes unnecessary filesystem monitoring of WEB-INF/lib JARs, increasing the chance of classloader issues during shutdown
  3. Missing container.destroy() means Tomcat resources aren't fully released after stop

Changes

  • Fix shutdown hook order: Stop Tomcat first, then MariaDB — ensures Tomcat can cleanly finish context destruction before the database is killed
  • Set reloadable=false: Hot-reloading is unnecessary for a standalone distribution
  • Call container.destroy() after container.stop(): Proper Tomcat lifecycle cleanup (stop halts components, destroy releases resources)

- Change shutdown hook order to stop Tomcat first, then MariaDB,
  ensuring Tomcat can cleanly finish context cleanup before the
  database is killed
- Set context reloadable=false since hot-reloading is unnecessary
  for a standalone distribution and causes extra file monitoring
- Call container.destroy() after container.stop() for proper
  Tomcat lifecycle cleanup

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dkayiwa dkayiwa merged commit 6a06a5b into openmrs-emr3 Feb 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant