Skip to content

Conversation

victornoel
Copy link

Here is a reproducer for https://hibernate.atlassian.net/browse/HHH-19280.

The issue is when the DataSource used in MyConnectionProvider is wrapped with the OpenTelemetry JDBC instrumenter. I decided to reuse the ConnectionProvider implementation from Hikari just because I didn't know how to do something simpler, but the problem has nothing to do with Hikari.

Note the debug logs in the log4j file, executing the test will print:

2025-03-26 10:21:45 DEBUG ResourceRegistryStandardImpl:202 - Exception clearing maxRows/queryTimeout [The object is already closed [90007-232]]

The reason why we see this and why it's a problem is explained here: https://hibernate.atlassian.net/browse/HHH-19280?focusedCommentId=119939

@@ -0,0 +1,152 @@
package org.hibernate.bugs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add

/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright Red Hat Inc. and Hibernate Authors
 */

to the class?
Thanks

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can but actually is this correct? it's a copy paste of HikariCPConnectionProvider which have:

/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later.
 * See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
 */

Also, ideally, if you know of a way to do without hikaricp, it would be even better :) is there some idiomatic way of wrapping the DataSource used in the tests without implementing my own ConnectionProvider for example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I'll try to figure it out. Thanks again for the reproducer.

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.

2 participants