{"record":{"id":"c6f89451f662829f","repo":"apache/seatunnel","slug":"delete-pit-failed","errorCode":"DELETE_PIT_FAILED","errorMessage":"DELETE /_pit response null","messagePattern":"DELETE /_pit response null","errorType":"error_code","errorClass":"ElasticsearchConnectorException","httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java","lineNumber":966,"sourceCode":"        }\n    }\n\n    /**\n     * Deletes a Point-in-Time (PIT).\n     *\n     * @param pitId The PIT ID to delete\n     * @return True if the PIT was successfully deleted\n     */\n    public boolean deletePointInTime(String pitId) {\n        String endpoint = \"/_pit\";\n        Request request = new Request(\"DELETE\", endpoint);\n        Map<String, String> requestBody = new HashMap<>();\n        requestBody.put(\"id\", pitId);\n        request.setJsonEntity(JsonUtils.toJsonString(requestBody));\n        try {\n            Response response = restClient.performRequest(request);\n            if (response == null) {\n                throw new ElasticsearchConnectorException(\n                        ElasticsearchConnectorErrorCode.DELETE_PIT_FAILED,\n                        \"DELETE \" + endpoint + \" response null\");\n            }\n            String entity = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);\n            if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {\n                JsonNode jsonNode = JsonUtils.parseObject(entity);\n                return jsonNode.get(\"succeeded\").asBoolean();\n            } else {\n                throw new ElasticsearchConnectorException(\n                        ElasticsearchConnectorErrorCode.DELETE_PIT_FAILED,\n                        String.format(\n                                \"DELETE %s response status code=%d, body=%s\",\n                                endpoint, response.getStatusLine().getStatusCode(), entity));\n            }\n        } catch (IOException ex) {\n            throw new ElasticsearchConnectorException(\n                    ElasticsearchConnectorErrorCode.DELETE_PIT_FAILED, ex);\n        }","sourceCodeStart":948,"sourceCodeEnd":984,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/client/EsRestClient.java#L948-L984","documentation":"deletePointInTime closes a PIT context (DELETE /_pit with the pit id in the body); if performRequest returns null the client throws DELETE_PIT_FAILED. This happens at the end of a read; a null response means the cleanup request never got an HTTP answer, potentially leaving the PIT open on the server until keep_alive expires.","triggerScenarios":"DELETE /_pit (body: {\"id\":\"<pitId>\"}) returning null Response from performRequest.","commonSituations":"Custom/mock RestClient returning null; connection already broken after a long read so the DELETE cannot be delivered; proxy dropping idle connections mid-job.","solutions":["Ignore-and-retry is usually safe: the PIT auto-expires after keep_alive, so rerunning rarely causes resource exhaustion","Check cluster for lingering PITs (GET /_nodes/stats) and wait for expiry or restart node if leaking","Verify network stability for long-running jobs (idle TCP timeouts on LBs); tune keep-alive/TCP settings","Fix any custom client wrapper that can return null instead of throwing"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// ensure the PIT id is present before cleanup\nif (pitId == null || pitId.isEmpty()) { skipDelete(); }","typeGuard":"if (pitId == null || pitId.isEmpty()) { return; } // nothing to delete","tryCatchPattern":"try {\n    esRestClient.deletePointInTime(pitId);\n} catch (ElasticsearchConnectorException e) {\n    // cleanup is best-effort: log WARN, PIT expires via keep_alive\n    log.warn(\"PIT cleanup failed, will expire via keep_alive\", e);\n}","preventionTips":["Treat PIT deletion as best-effort cleanup, not a hard requirement","Set keep_alive so leaked PITs expire quickly","Avoid idle-connection-dropping proxies for long jobs","Monitor open PIT contexts via /_nodes/stats to catch leaks"],"tags":["elasticsearch","point-in-time","null-response","cleanup"],"backgroundTag":"http-request-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}