Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
alexsander55 opened this issue Jun 24, 2020 · 6 comments
Open
Labels
type: enhancement A general enhancement

Comments

@alexsander55
Copy link

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
Copy link
Collaborator

tomix26 commented Jun 26, 2020

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.

@AndreKoepke
Copy link

AndreKoepke commented Dec 3, 2024

I have the same problem with Testcontainer databases. They run forever.

AndreKoepke added a commit to AndreKoepke/embedded-database-spring-test that referenced this issue Dec 3, 2024
@tomix26
Copy link
Collaborator

tomix26 commented Dec 3, 2024

I have the same problem with Testcontainer databases. They run forever.

If you are using the Docker provider, the Testcontainers library should take care of cleaning up the database containers itself. It uses a helper Ryuk container for this purpose. Please make sure you haven't disabled this functionality - https://java.testcontainers.org/features/configuration/#disabling-ryuk

@AndreKoepke
Copy link

It seems to be a local problem for me. In my case (MacBook M4 with Podman), the Ryuk-container behaves correcty, but the Postgres-Containers not.

In my team, I'm the only one with that problem. I would then just decline my PR here. :)
Thanks for the help. 👍

@tomix26
Copy link
Collaborator

tomix26 commented Dec 4, 2024

It seems to be a local problem for me. In my case (MacBook M4 with Podman), the Ryuk-container behaves correcty, but the Postgres-Containers not.

In my team, I'm the only one with that problem. I would then just decline my PR here. :) Thanks for the help. 👍

The problem might be caused by using Podman. Testcontainers should support it, but I've never tried it myself. So I'm not sure if the library is fully compatible. If you figure out what's causing the issue and it's something I can fix, let me know.

@AndreKoepke
Copy link

A colleague has also a MacBook (M1) with Podman. And for him, it works correctly. Funny thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants