zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
401 stars 37 forks source link

POstgres service not getting killed for imporper shutdown of test case #105

Open alexsander55 opened 4 years ago

alexsander55 commented 4 years ago

Capture

While running the test case , when the springboot test is shutdown forcefully in windows , the postgres intance that started is not getting killed.

version of embedded-database-spring-test used is 1.5.4 Window machine

tomix26 commented 4 years ago

Thanks for the report. I'll try to look at it, but I'm afraid there's not much that can be done about it. Because a shutdown hook is already registered every time a new postgres process is started, and as you can see, that's not enough.

Javadoc describing the behavior of shutdown hooks:

In rare circumstances the virtual machine may abort, that is, stop running without shutting down cleanly. This occurs when the virtual machine is terminated externally, for example with the SIGKILL signal on Unix or the TerminateProcess call on Microsoft Windows. The virtual machine may also abort if a native method goes awry by, for example, corrupting internal data structures or attempting to access nonexistent memory. If the virtual machine aborts then no guarantee can be made about whether or not any shutdown hooks will be run.