Skip to content

The ReactiveConnectionPoolProvider implementation is leaking threads #129

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

Closed
Sanne opened this issue May 19, 2020 · 10 comments · Fixed by #156
Closed

The ReactiveConnectionPoolProvider implementation is leaking threads #129

Sanne opened this issue May 19, 2020 · 10 comments · Fixed by #156
Assignees
Labels
bug Something isn't working

Comments

@Sanne
Copy link
Member

Sanne commented May 19, 2020

When I forget to start the database and then run all integration tests, I see errors like these being logged repeatedly:

Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "vertx-blocked-thread-checker"

I haven't verified my theory but in my experience this makes me suspect that the testsuite is leaking threads. If it's "just" the testsuite in these conditions that might not be critical, but I wonder if it could affect regular runtime.

@Sanne Sanne added bug Something isn't working testing Improvements to test suite labels May 19, 2020
@gavinking
Copy link
Member

Probably related to the new schema export stuff. In which case it won't affect the runtime.

@Sanne
Copy link
Member Author

Sanne commented May 19, 2020

Turns out I have the same problem even with databases turned on - it just takes longer to appear.

I'll try to get a profiler connected

@Sanne
Copy link
Member Author

Sanne commented May 19, 2020

Probably related to the new schema export stuff. In which case it won't affect the runtime.

you guessed right, threads are stuck on:

at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1707)
at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
at java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1742)
at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1947)
at org.hibernate.reactive.service.ReactiveGenerationTarget.accept(ReactiveGenerationTarget.java:29)
at org.hibernate.tool.schema.internal.SchemaDropperImpl$DelayedDropActionImpl.perform(SchemaDropperImpl.java:542)
at org.hibernate.internal.SessionFactoryImpl.close(SessionFactoryImpl.java:792)
at org.hibernate.reactive.BaseReactiveTest.after(BaseReactiveTest.java:75)
at org.hibernate.reactive.CompositeIdTest.lambda$after$0(CompositeIdTest.java:39)
at org.hibernate.reactive.CompositeIdTest$$Lambda$163/959646593.accept(Unknown Source)
at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)
at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488)
at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:1975)
at org.hibernate.reactive.impl.PoolConnection.lambda$toCompletionStage$5(PoolConnection.java:103)

Why wouldn't this affect runtime? but also, how am I supposed to launch the tests?

@gavinking
Copy link
Member

Why wouldn't this affect runtime?

You don't run hundreds of schema exports at runtime.

@Sanne
Copy link
Member Author

Sanne commented May 19, 2020

Why wouldn't this affect runtime?

You don't run hundreds of schema exports at runtime.

Even if it's just one, we can't have a thread stuck forever?

Anyway, my OOM seems caused by running it with JDK8: with JDK11 it works.

@gavinking
Copy link
Member

Even if it's just one, we can't have a thread stuck forever?

It's actually only the schema dropper that has a problem, and that's probably because of how the session factory gets closed within the test suite.

If I set:

configuration.setProperty( AvailableSettings.HBM2DDL_AUTO, "create" );

in BaseReactiveTest, the problem seems to disappear.

@gavinking
Copy link
Member

Pretty sure this is fixed now.

@Sanne
Copy link
Member Author

Sanne commented May 20, 2020

Thanks. I still have OOMs when building with JDK8 though - I can't investigate now, I'll see if I can diagnose it an evening.

@Sanne
Copy link
Member Author

Sanne commented May 21, 2020

Ok, I was able to figure it out - I'll send a PR later.

@Sanne Sanne self-assigned this May 21, 2020
@Sanne Sanne removed the testing Improvements to test suite label May 21, 2020
@Sanne Sanne changed the title Testsuite is leaking threads The ReactiveConnectionPoolProvider implementation is leaking threads May 21, 2020
@Sanne
Copy link
Member Author

Sanne commented May 21, 2020

Changed the title as the problem was in the actual runtime code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants