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

[BUG] Embedded Exist-DB clears ThreadLocals unrelated to Exist on shutdown #5601

Open
SamuelBussmann opened this issue Jan 7, 2025 · 2 comments
Labels
investigate issues being looked at

Comments

@SamuelBussmann
Copy link

SamuelBussmann commented Jan 7, 2025

The Memory-Leak fix ThreadLocal for all threads will be cleared up on shutdown clears all ThreadLocals of the whole JVM even if they are not owned/created by exist.
When using embedded exist-db in e.g integration testing this leads to a changed system state if the db is shutdown before the end of the test and ThreadLocals are used by the system under test or the testing harness.
Our current solution is to snapshot relevant ThreadLocals and restore them after completing the db.shutdown().
But maybe the current implementation could be extended to filter/skip "external" ThreadLocals.

This issue was encountered with eXist-db 6.3.0

@line-o
Copy link
Member

line-o commented Jan 10, 2025

@SamuelBussmann First of all, thank you for reporting this issue. We will probably discuss this next week on Monday on our community call. You can join us if you are interested.

@line-o line-o added the investigate issues being looked at label Jan 10, 2025
@SamuelBussmann
Copy link
Author

SamuelBussmann commented Jan 10, 2025

I'll see if I can participate at the meeting.

For us we have several options to workaround the issue. So it's not really a problem anymore.

But it was a bit tricky to trace it back to this source, as the behaviour seemed to differ between single local tests or CI. It seemed to be skiped or delayed for some cases of shutdown()-calls, but I couldn't find any reason within the code-path to not always execute the clearThreadLocals()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate issues being looked at
Projects
None yet
Development

No branches or pull requests

2 participants