{"record":{"id":"5ed6eb497703fb85","repo":"t8y2/dbx","slug":"no-active-jdbc-checkout-owns-physical-connection-c","errorCode":null,"errorMessage":"No active JDBC checkout owns physical connection creation","messagePattern":"No active JDBC checkout owns physical connection creation","errorType":"exception","errorClass":"SQLTransientConnectionException","httpStatus":null,"severity":"error","filePath":"agents/common/src/main/java/com/dbx/agent/JdbcConnectionPoolRegistry.java","lineNumber":1080,"sourceCode":"        private void poison(SQLException failure) {\n            causalFailure.compareAndSet(null, failure);\n            signalAttemptStateChanged();\n        }\n\n        private DeadlineRegistration registerCheckout(OperationDeadline deadline) {\n            checkoutDeadlines.add(deadline);\n            return new DeadlineRegistration(deadline);\n        }\n\n        private OperationDeadline currentCheckoutDeadline() throws SQLException {\n            OperationDeadline earliest = null;\n            for (OperationDeadline deadline : checkoutDeadlines) {\n                if (earliest == null || deadline.deadlineNanos < earliest.deadlineNanos) {\n                    earliest = deadline;\n                }\n            }\n            if (earliest == null) {\n                throw new SQLTransientConnectionException(\"No active JDBC checkout owns physical connection creation\");\n            }\n            return earliest;\n        }\n\n        private final class DeadlineRegistration implements AutoCloseable {\n            private final OperationDeadline deadline;\n\n            private DeadlineRegistration(OperationDeadline deadline) {\n                this.deadline = deadline;\n            }\n\n            @Override\n            public void close() {\n                checkoutDeadlines.remove(deadline);\n            }\n        }\n\n        @Override","sourceCodeStart":1062,"sourceCodeEnd":1098,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/common/src/main/java/com/dbx/agent/JdbcConnectionPoolRegistry.java#L1062-L1098","documentation":"Thrown as SQLTransientConnectionException when computing the earliest deadline for physical connection creation finds no registered OperationDeadline. Physical connects must occur inside an active JDBC checkout that owns a deadline; this error means the code attempted to find/create a physical connection outside any such checkout scope.","triggerScenarios":"Internal code paths call earliestDeadline()/deadline computation on a CheckoutExecutor (or a physical connect is driven from the factory DataSource) without a checkout having registered a deadline via the DeadlineRegistration mechanism — e.g. using the DataSource directly outside pool.checkout().","commonSituations":"Calling getConnection() on the wrapped factory DataSource outside a checkout; lifecycle callbacks (e.g. connection validation/keepalive) racing with pool retirement so all registrations are already closed; misuse of internal APIs from custom code.","solutions":["Ensure all physical connection acquisition goes through the pool's checkout path, which registers an OperationDeadline","Verify the checkout is still active (not retired/closed) when triggering physical connects","If invoking internal CheckoutExecutor methods directly, register a DeadlineRegistration first and close it in a finally block","Upgrade/report if a keepalive or validation timer triggers physical connects after checkout teardown"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Ensure physical connects happen only through pool.checkout();\n// assert a checkout is active before touching the factory DataSource:\nif (!pool.hasActiveCheckout()) {\n    throw new IllegalStateException(\"physical connect requires an active checkout\");\n}","typeGuard":"static boolean hasDeadlineScope(CheckoutExecutor exec) {\n    return exec != null && exec.hasRegisteredDeadline();\n}","tryCatchPattern":"try {\n    lease = pool.checkout();\n} catch (SQLTransientConnectionException e) {\n    if (e.getMessage().contains(\"No active JDBC checkout\")) {\n        // route through pool.checkout() instead of direct factory access\n    }\n    throw e;\n}","preventionTips":["Never call the wrapped/factory DataSource directly; always go through pool.checkout()","Keep keepalive/validation timers lifecycle-managed so they cannot fire after checkout teardown","Register and close DeadlineRegistration symmetrically (try-with-resources) in custom internal usage","Pin/upgrade to a library version where internal paths always register a deadline"],"tags":["jdbc","connection-pool","lifecycle","internal-state"],"backgroundTag":"connection-lease-scope-invalid","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}