Repository navigation
Fixes #35373: Stop Jdbi pinning virtual threads and the test suite summary 404 on deleted test cases - #35374
Conversation
Jdbi 3.37.1 opens an on-demand handle inside a synchronized block, so a virtual thread that parks in HikariDataSource.getConnection keeps its carrier thread. With leak detection on, enough of them parked on Hikari's scheduler lock stop the server's virtual-thread scheduler for good. That is the integration-test lane wedge: every stall dump shows four threads pinned in MemoizingSupplier.init on a four-CPU runner. Bump Jdbi to 3.49.5, the version dropwizard-jdbi3 5.0.0 is built against, and register the connection-aware SQL annotations through @UseExtensionHandler, which replaced @SqlOperation for Jdbi's own statement handlers. JdbiVirtualThreadPinningTest records jdk.VirtualThreadPinned around a handle open and fails on 3.37.1.
The suite summary looked up every listed test case by name, one at a time. A test case deleted after its results were listed made the lookup throw, so reading the suite returned 404 "Entity not found: testCase" after a logical-suite change had already committed. "Select all" puts every test case in the database into the suite, which widens that window to every test case another request deletes. That is why TestCaseResourceIT's bulk-add tests failed with another test's test case in the message. Read the listed test cases in one batch and drop the results of any that no longer exist, which also replaces one lookup per result with a single query.
Code Review ✅ Approved🟡 Medium risk · The backend-wide Jdbi upgrade changes DAO execution and handler registration; incompatibilities could disrupt database operations or virtual-thread request handling. Upgrades Jdbi from 3.37.1 to 3.49.5 and migrates the connection-aware SQL annotations to VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
Local Java test run: FAILED — details
Failed: Selected but produced no report: Every test skipped, so these exercised nothing (check their assumptions — usually the engine): Tests run locally
Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts. integration · mysql-elasticsearch · parallel: 340 classes
integration · postgres-opensearch · parallel: 40 classes
Why these tests
Impacted, not run locally (2)
Commandsmvn -B package -pl common,openmetadata-k8s-operator,openmetadata-mcp,openmetadata-service -am -Dspring-boot.repackage.skip=true '-Dtest=org/openmetadata/annotations/**/*Test.java,org/openmetadata/annotations/**/Test*.java,org/openmetadata/annotations/**/*Tests.java,org/openmetadata/annotations/**/*TestCase.java,org/openmetadata/common/**/*Test.java,org/openmetadata/common/**/Test*.java,org/openmetadata/common/**/*Tests.java,org/openmetadata/common/**/*TestCase.java,org/openmetadata/operator/**/*Test.java,org/openmetadata/operator/**/Test*.java,org/openmetadata/operator/**/*Tests.java,org/openmetadata/operator/**/*TestCase.java,org/openmetadata/mcp/**/*Test.java,org/openmetadata/mcp/**/Test*.java,org/openmetadata/mcp/**/*Tests.java,org/openmetadata/mcp/**/*TestCase.java,org/openmetadata/DefaultOperationalConfigProviderTest.java,org/openmetadata/csv/**/*Test.java,org/openmetadata/csv/**/Test*.java,org/openmetadata/csv/**/*Tests.java,org/openmetadata/csv/**/*TestCase.java,org/openmetadata/schema/**/*Test.java,org/openmetadata/schema/**/Test*.java,org/openmetadata/schema/**/*Tests.java,org/openmetadata/schema/**/*TestCase.java,org/openmetadata/sdk/**/*Test.java,org/openmetadata/sdk/**/Test*.java,org/openmetadata/sdk/**/*Tests.java,org/openmetadata/sdk/**/*TestCase.java,org/openmetadata/service/**/*Test.java,org/openmetadata/service/**/Test*.java,org/openmetadata/service/**/*Tests.java,org/openmetadata/service/**/*TestCase.java' -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=<336 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=AppsResourceIT,ConversationSchemaMigrationIT,CsvExportMultiNodeIT,DataContractValidationAppIT,EntityShapeIT,GlossaryOntologyExportIT,MetricMigrationIT,SearchIndexRetryQueueIT,SessionMultiNodeIT,SystemResourceIT,TagRecognizerFeedbackIT,TestSuiteReindexIT,UserMetricsResourceIT,VectorEmbeddingIntegrationIT,WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=rdf -Dit.test=AgentSparqlResourceIT,LodResourceIT,RdfBatchFieldsIT,RdfBlueGreenRebuildIT,RdfConceptRealizationIT,RdfFusekiAuthorizationIT,RdfGlossaryGraphIT,RdfGovernanceRulesIT,RdfGraphExploreIT,RdfIndexAppScaleIT,RdfIndexRunRecoveryIT,RdfInferenceMaterializationIT,RdfInferenceMultiServerIT,RdfLiveProjectionIT,RdfLiveWriteRecoveryIT,RdfReindexFailuresIT,RdfReindexInsertOnlyIT,RdfReindexRunLockIT,RdfRelationExclusionsIT,RdfResourceIT,RdfRoundTripFidelityIT,RdfSemanticSearchIT,RdfSourceRevisionIT,RdfSqlResourceIT,RdfStorageReadinessIT,RdfTagsTierCertificationIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=parallel -Dit.test=AlertStateIT,BundleWarmupCertificationIT,ContainerCacheCorrectnessIT,EntityCacheWriteOrderIT,OneTransactionFlushAtomicityIT,RelationshipCacheInvalidationIT,TagRenameCacheIT,UncachedReadIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pcache-tests -DintegrationTests.lane=global-state -Dit.test=SessionRedisMultiNodeIT,TokenRevocationRedisMultiNodeIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=parallel '-Dit.test=<39 classes>' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Ppostgres-opensearch -DintegrationTests.lane=global-state -Dit.test=EntityShapeIT,PatchTableEmbeddingIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Psearch-it -DdatabaseType=postgres -DsearchType=opensearch -Djpw.data.mode=ingest -Dit.test=TestCaseStaleDefinitionReindexIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false |
…en-metadata#35469) Jdbi 3.38+ builds a handler, each with its own configuration copy, for every method of a SQL object whenever it is attached, and an on-demand DAO is attached on every call. After the 3.37.1 -> 3.49.5 bump (open-metadata#35374) one getCollectionDAO().tableDAO() query allocated ~747 KB; the server allocated 2.7x more overall and the single workflow-event consumer fell behind, timing out approval ITs on every engine. LazySqlObjectFactory sits in front of Jdbi's SqlObjectFactory, reuses the same ExtensionMetadata, makes one instance configuration per attach and builds a method's handler the first time it is called. Nested @CreateSqlObject DAOs on a handle are attached the same way. Handlers are built outside any lock, so attaching never pins a virtual thread.
…ads (open-metadata#35429) * Stop cache-miss loads pinning virtual threads On JDK 21 a virtual thread that blocks while holding a monitor keeps its carrier thread. Guava LoadingCache.get, Caffeine get and ConcurrentHashMap.compute all run the loader inside synchronized, so a cache miss that reads Redis or the database pins the thread. In six merge-queue stalls of the Postgres + OpenSearch IT lane all four carriers of the runner were pinned; 3 of the 24 pinned threads were in the entity cache's Guava load (the rest were Jdbi, fixed by open-metadata#35374). Add SingleFlight: runs a miss on the caller's thread with no monitor held, at most one load per key, other callers waiting on a CompletableFuture. - EntityRepository find/findByName load misses through SingleFlight and re-check the write epoch after the put, evicting if a write raced the load. Loaders stay attached so direct CACHE_WITH_* callers are unchanged. - AuditLogRepository, OwnerResolver, RdfPropertyMapper: read, then put. - EntityStatusWorkflows: SingleFlight plus an invalidation counter so a workflow change during a load is not hidden by what the load read. - StageStatsTracker.flush: ReentrantLock instead of synchronized. * Record why cache misses that do I/O load outside the cache lock * Keep only the entity-cache fix, without SingleFlight Only the entity cache's Guava load showed up pinned in the stall dumps. Load the miss with a plain read, put and epoch re-check in EntityRepository instead of a new SingleFlight class, and revert the preventive changes to the audit bot cache, OwnerResolver, RdfPropertyMapper, EntityStatusWorkflows and StageStatsTracker, plus the decision record. * Record why entity-cache misses load outside the cache lock
… (#38520) * Fixes #35373: Stop Jdbi pinning virtual threads and the test suite summary 404 on deleted test cases (#35374) * Build Jdbi SQL object handlers on first call, not on every attach (#35469) * Fixes #35428: Stop cache-miss loads pinning virtual threads (#35429) --------- Co-authored-by: Mohit Yadav <105265192+mohityadav766@users.noreply.github.com> Co-authored-by: Ram Narayan Balaji <81347100+yan-3005@users.noreply.github.com>
Describe your changes:
Fixes #35373
TestCaseResourceIT's bulk tests are the most frequent merge-queue failure, and two unrelated bugscause it. #35373 has the evidence: annotations from 267 failing lane reports and 12 stall dumps.
1. Jdbi pins virtual threads, so the IT server stalls (21 PRs). Jdbi 3.37.1 opens an on-demand
handle inside a
synchronizedblock. A virtual thread that parks inHikariDataSource.getConnectiontherefore keeps its carrier thread. On the 4-CPU runners, four such threads queued on Hikari's
leak-detection lock stop the virtual-thread scheduler for the rest of the run. Logical-suite add and
remove reindex through virtual threads, so they time out first.
pom.xml: Jdbi 3.37.1 → 3.49.5, the versiondropwizard-jdbi35.0.0 is built against.jdbi3-coreand
jdbi3-sqlobjectnow match thejdbi3-guavathat Dropwizard already brought in at 3.49.5. Jdbireplaced the
synchronizedblock with aReentrantLockin 3.45.4.ConnectionAwareSql*annotations change from@SqlOperation(XHandler.class)to@UseExtensionHandler(id = SqlObjectFactory.EXTENSION_ID, value = XHandler.class). That is howJdbi's own
@SqlQuery,@SqlUpdateand@SqlBatchregister since 3.38. The internal handlers nolonger implement
Handler, so the old form doesn't compile. This is probably what the old pom comment"Upgrading to jdbi version causes test failures" referred to.
ADR:2026-10-13-jdbi-never-pins-virtual-threads-and-collate-runs-the-same-version.2. The suite summary returns 404 for a test case deleted mid-request (8 PRs).
TestSuiteRepository.getTestSummarylooked up every listed test case by name, one at a time. A testcase deleted after its results were listed made the lookup throw, so loading the suite returned 404
after a logical-suite change had already committed.
mode: allputs every test case in the databaseinto the suite, so another IT's deletes kept hitting it. The summary now reads the test cases in one
findByNamesbatch and leaves out the ones that are gone.Collate: open-metadata/openmetadata-collate#7428 moves Collate to the same Jdbi. Collate pins Jdbi 3.37.1 itself, and
collate-supportpins 3.39.1. Jdbi 3.37 has no@UseExtensionHandler, so the Collate PR must merge right after this one, or Collate's DAOs stop working.Type of change:
High-level design:
N/A. This is a dependency bump, a mechanical annotation migration and a one-method fix.
Tests:
Use cases covered
of returning 404.
Unit tests
JdbiVirtualThreadPinningTest(new) recordsjdk.VirtualThreadPinnedwith JFR while anon-demand DAO waits for a connection. On 3.37.1 it fails with the stack from the CI dumps
(
MemoizingSupplier.init:68→LazyHandleSupplier.createHandle:63→Jdbi.open:318). On 3.49.5 itpasses.
ConnectionAwareAnnotationSqlLocatorTestasserts the new registration, now also for the threerepeatable containers.
TestSuiteRepositoryTest.summaryLeavesOutResultsOfTestCasesDeletedAfterTheyWereListedfailsbefore the fix with
Entity not found: testCase …and passes after it.Backend integration tests
pom.xmlchanged.The local run follows.
Local Java test run: FAILED
b033e79d16d4(baseorigin/main)Failed:
TaskWorkflowLifecycleResolverTest#workflowStartVariablesTolerateNullOptionalFieldsSelected but produced no report:
McpServiceResourceIT (mysql-elasticsearch · parallel)Every test skipped, so these exercised nothing (check their assumptions — usually the engine):
DataRetentionAppIT (mysql-elasticsearch · parallel),SearchIndexPromotionIT (mysql-elasticsearch · parallel),SearchIndexingFieldsParityIT (mysql-elasticsearch · parallel),WritePathBenchmarkIT (mysql-elasticsearch · parallel),RdfIndexAppScaleIT (mysql-elasticsearch · rdf),WritePathBenchmarkIT (postgres-opensearch · parallel),PatchTableEmbeddingIT (postgres-opensearch · isolated)UI screen recording:
Not applicable: backend-only change.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.docs/decisions/(see itsREADME.md). This description is gone fromgit logafter the squash-merge.🤖 Generated with Claude Code