Skip to content

HIVE-28839: Connection starvation in HMS if datanucleus value generation fails #5829

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
wants to merge 1 commit into from

Conversation

zabetak
Copy link
Member

@zabetak zabetak commented May 28, 2025

What changes were proposed in this pull request and why?

  1. Upgrade to datanucleus-rdbms version 5.2.13 that contains the fix for the connection leak (SQLException during value generation leads to (non transactional) connection leak datanucleus/datanucleus-rdbms#501).
  2. Add a test case reproducing the connection leak by introducing random failures on commit using the jdbc-faulty project.

Does this PR introduce any user-facing change?

Yes, fixes the leak.

How was this patch tested?

mvn clean test -Dtest=TestObjectStoreSecondaryPoolLeak -Dtest.groups=

Before the datanucleus upgrade

The test fails with the following error:

[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 40.73 s <<< FAILURE! -- in org.apache.hadoop.hive.metastore.TestObjectStoreSecondaryPoolLeak
[ERROR] org.apache.hadoop.hive.metastore.TestObjectStoreSecondaryPoolLeak.testCreateTableWithRandomTimeoutOnCommit -- Time elapsed: 30.23 s <<< FAILURE!
org.opentest4j.AssertionFailedError: Connection leak during creation of table_28
	at org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:42)
	at org.junit.jupiter.api.Assertions.fail(Assertions.java:150)
	at org.apache.hadoop.hive.metastore.TestObjectStoreSecondaryPoolLeak.testCreateTableWithRandomTimeoutOnCommit(TestObjectStoreSecondaryPoolLeak.java:103)
...

After the datanucleus upgrade

The test passes successfully in ~40 seconds.

[INFO] Running org.apache.hadoop.hive.metastore.TestObjectStoreSecondaryPoolLeak
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 39.89 s -- in org.apache.hadoop.hive.metastore.TestObjectStoreSecondaryPoolLeak
[INFO] 
[INFO] Results:
[INFO] 
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

…ion fails

1. Upgrade to datanucleus-rdbms version 5.2.13 that contains the fix for the connection leak (datanucleus/datanucleus-rdbms#501).
2. Add a test case reproducing the connection leak by introducing random failures on commit using the jdbc-faulty project.
Copy link

* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
Copy link
Member

Choose a reason for hiding this comment

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

can we move this test to a separate PR so it only contains upgrading datanucleus

Copy link
Member Author

Choose a reason for hiding this comment

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

Whenever we fix a bug we usually want to have a test that proves that the bug is fixed. Why should we separate the them here?

Copy link
Member

Choose a reason for hiding this comment

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

The main point is we use a private dependency for this test, I'm not sure if this is a good practice for the project

Copy link
Member Author

Choose a reason for hiding this comment

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

There is nothing specific to jdbc-faulty that distinguishes it from other similar dependencies. For instance, HikariCP is maintained principally by one person, datanucleus as well, and possibly many others from those that are listed in the project.

I can understand that there is a burden when new dependencies come to the project but in the end it is a question of pros & cons. If you believe that the test does not add enough value then I am fine to remove it.

@zabetak
Copy link
Member Author

zabetak commented Jun 10, 2025

There has been an upgrade to a more recent version of datanucleus (which contains the bug fix) in HIVE-26473. The test-case is still relevant but given that there have been concerns about the new test dependency that are necessary for the PR to land I plan to leave things as is for now thus closing this PR.

@zabetak zabetak closed this Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants