{"record":{"id":"6ee0c70b06e1d269","repo":"apache/seatunnel","slug":"thread-interrupted","errorCode":null,"errorMessage":"Thread interrupted","messagePattern":"Thread interrupted","errorType":"exception","errorClass":"InterruptedException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Utils.java","lineNumber":177,"sourceCode":"            stmt =\n                    jdbc.connection()\n                            .createStatement(\n                                    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);\n\n            stmt.setFetchSize(1024);\n            rs = stmt.executeQuery(sampleQuery);\n\n            int count = 0;\n            while (rs.next()) {\n                count++;\n                if (count % 100000 == 0) {\n                    log.info(\"Processing row index: {}\", count);\n                }\n                if (count % inverseSamplingRate == 0) {\n                    results.add(rs.getObject(1));\n                }\n                if (Thread.currentThread().isInterrupted()) {\n                    throw new InterruptedException(\"Thread interrupted\");\n                }\n            }\n        } finally {\n            if (rs != null) {\n                try {\n                    rs.close();\n                } catch (SQLException e) {\n                    log.error(\"Failed to close ResultSet\", e);\n                }\n            }\n            if (stmt != null) {\n                try {\n                    stmt.close();\n                } catch (SQLException e) {\n                    log.error(\"Failed to close Statement\", e);\n                }\n            }\n        }","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-cdc/connector-cdc-db2/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/db2/utils/Db2Utils.java#L159-L195","documentation":"Db2Utils.skipReadAndSortSampleData samples column values for chunk splitting and checks Thread interruption inside the result loop. When the worker thread is interrupted (task cancelled or checkpoint/closure), it throws InterruptedException('Thread interrupted') to stop sampling promptly.","triggerScenarios":"The task thread running sample-based split construction gets interrupted — job cancelled by user, pipeline stopped, or engine shutting down while sampling a large table.","commonSituations":"Cancelling a long-running incremental-snapshot job on a big DB2 table; engine failover/stop during the sampling phase; CLI Ctrl-C during job startup.","solutions":["No fix needed if you intentionally cancelled the job — this is expected cleanup","If unexpected, check job manager logs for the original cancellation/shutdown cause","Retry the job; sampling will restart","Reduce table size or use non-sampling chunk strategy to shorten the interruption window"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { Db2Utils.skipReadAndSortSampleData(...); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); /* expected on cancel: exit sampling and restore interrupt flag */ }","preventionTips":["Treat this as normal during job cancellation — always restore the interrupt flag","Avoid cancelling during snapshot startup on huge tables when possible","Monitor job-manager logs to distinguish expected vs unexpected interruption"],"tags":["interruption","db2","cdc","cancellation"],"backgroundTag":"thread-interrupted","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}