{"record":{"id":"124a6e018c64eb48","repo":"conductor-oss/conductor","slug":"interrupted-while-waiting-for-connection-pool","errorCode":null,"errorMessage":"Interrupted while waiting for connection pool","messagePattern":"Interrupted while waiting for connection pool","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"ai/src/main/java/org/conductoross/conductor/ai/vectordb/postgres/PostgresVectorDB.java","lineNumber":120,"sourceCode":"        hikariConfig.setIdleTimeout(60_000);\n\n        return new HikariDataSource(hikariConfig);\n    }\n\n    private void waitForConnectionPoolReady(DataSource dataSource) {\n        if (dataSource instanceof HikariDataSource) {\n            HikariDataSource hikariDataSource = (HikariDataSource) dataSource;\n            int maxWaitTime = 5000; // 5 seconds\n            int waitInterval = 20; // 20ms\n            int totalWaited = 0;\n\n            while (!hikariDataSource.isRunning() && totalWaited < maxWaitTime) {\n                try {\n                    Thread.sleep(waitInterval);\n                    totalWaited += waitInterval;\n                } catch (InterruptedException e) {\n                    Thread.currentThread().interrupt();\n                    throw new RuntimeException(\"Interrupted while waiting for connection pool\", e);\n                }\n            }\n\n            if (!hikariDataSource.isRunning()) {\n                throw new RuntimeException(\n                        \"Connection pool failed to start within \" + maxWaitTime + \"ms\");\n            }\n        }\n    }\n\n    @Override\n    public int updateEmbeddings(\n            String indexName,\n            String namespace,\n            String doc,\n            String parentDocId,\n            String id,\n            List<Float> embeddings,","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/ai/src/main/java/org/conductoross/conductor/ai/vectordb/postgres/PostgresVectorDB.java#L102-L138","documentation":"Thrown as a plain RuntimeException (wrapping InterruptedException) when the thread waiting for the HikariCP connection pool to report running is interrupted. The code re-interrupts the current thread (Thread.currentThread().interrupt()) before throwing, preserving the interrupt status. This is a thread-lifecycle interruption, not a pool misconfiguration.","triggerScenarios":"The waitForConnectionPoolReady loop (polling hikariDataSource.isRunning() every 20ms up to 5s) is interrupted by another thread calling interrupt() — e.g. task cancellation, shutdown, or executor eviction.","commonSituations":"Conductor shuts down or cancels the worker thread while it is warming up a pool; a higher-level timeout interrupts the worker; JVM/thread-pool eviction under pressure; a parent workflow cancellation propagating interrupt.","solutions":["If due to shutdown/cancellation, this is expected — no action needed beyond ensuring the interrupt propagates cleanly.","Avoid人为 interrupting worker threads; let the pool readiness wait complete.","If recurring outside shutdown, investigate what is interrupting the worker thread (executor eviction, cancellation).","Ensure the pool starts quickly (prepopulate connections) so the 5s window is not usually needed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Interruption is expected during shutdown/cancel; honor it and propagate.\ntry {\n    waitForConnectionPoolReady(dataSource);\n} catch (RuntimeException e) {\n    if (Thread.currentThread().isInterrupted()) {\n        // shutdown/cancel path — do not retry, let the task be rescheduled\n    } else {\n        throw e;\n    }\n}","preventionTips":["Avoid interrupting worker threads during pool warmup.","Pre-warm pools at startup so the 5s wait is rarely entered.","Distinguish interrupt-driven failures from real pool errors."],"tags":["postgres","vectordb","threading","connection-pool","interruption"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}