{"record":{"id":"04ddbd77908b8e16","repo":"apache/seatunnel","slug":"can-t-apply-resource-request-with-retry-times-m","errorCode":null,"errorMessage":"can't apply resource request with retry times: ${MAX_RETRY_TIMES}","messagePattern":"can't apply resource request with retry times: (.+?)","errorType":"exception","errorClass":"NoEnoughResourceException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/resourcemanager/ResourceRequestHandler.java","lineNumber":105,"sourceCode":"        this.registerWorker = registerWorker;\n        this.resourceManager = resourceManager;\n        this.allocateStrategy =\n                resourceManager.getEngineConfig().getSlotServiceConfig().getAllocateStrategy();\n        this.slotAllocationStrategy = slotAllocationStrategy;\n    }\n\n    public CompletableFuture<List<SlotProfile>> request(Map<String, String> tags) {\n        requestSlotWithRetry(resourceProfile, MAX_RETRY_TIMES, tags);\n        return completableFuture;\n    }\n\n    private CompletableFuture<SlotAndWorkerProfile> requestSlotWithRetry(\n            List<ResourceProfile> request, int retryTimes, Map<String, String> tags) {\n        if (retryTimes <= 0) {\n            LOGGER.fine(\"can't apply resource request with retry times: \" + MAX_RETRY_TIMES);\n            return CompletableFuture.supplyAsync(\n                    () -> {\n                        throw new NoEnoughResourceException(\n                                \"can't apply resource request with retry times: \"\n                                        + MAX_RETRY_TIMES);\n                    });\n        }\n        List<CompletableFuture<SlotAndWorkerProfile>> allRequestFuture = requestSlots(request);\n        // all resource preCheck done, also had sent request to worker\n        return getAllOfFuture(allRequestFuture)\n                .whenComplete(\n                        withTryCatch(\n                                LOGGER,\n                                (unused, error) -> {\n                                    if (error != null) {\n                                        completeRequestWithException(toExternalException(error));\n                                    } else {\n                                        List<ResourceProfile> needRequestResource =\n                                                stillNeedRequestResource();\n                                        if (!needRequestResource.isEmpty()) {\n                                            Exception requestSlotWithRetryError = null;","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/resourcemanager/ResourceRequestHandler.java#L87-L123","documentation":"ResourceRequestHandler retries slot requests up to MAX_RETRY_TIMES when the cluster lacks enough resources. If requestSlotWithRetry is invoked with a retryTimes counter that has already been exhausted (<=0), it immediately completes a failed future with NoEnoughResourceException instead of asking workers for slots. This means the resource manager gave up after all retries without securing the requested ResourceProfiles.","triggerScenarios":"Calling ResourceManager.request()/requestSlotWithRetry when retry budget is spent, i.e. the job could not get slots after MAX_RETRY_TIMES rounds of preCheck+request against all workers.","commonSituations":"Cluster has fewer available CPU/memory on worker nodes than the job's resource requirements; too many concurrent jobs exhausting slots; request tags matching no worker; misconfigured slot-num or dynamic resource profiles.","solutions":["Free up cluster resources: stop/finish other running jobs or scale up worker nodes (increase worker CPU/memory/slot counts)","Check job resource settings in the config (resource tags, cpu/memory per pipeline) and reduce them to fit available capacity","Verify MAX_RETRY_TIMES and increase it (engine config) so transient resource contention can be retried successfully","Inspect worker logs via REST /hazelcast/rest/map/running-job or cluster metrics to confirm which workers failed the pre-check"],"exampleFix":"// before: request larger resources than cluster has\nresource { cpu = 16; memory = \"64G\" }\n// after: match worker capacity\nresource { cpu = 2; memory = \"4G\" }","handlingStrategy":"retry","validationCode":"// compare requested vs available via REST\ncurl http://master:8080/hazelcast/rest/maps/used-resource  # ensure capacity >= request","typeGuard":null,"tryCatchPattern":"try {\n    slotFuture.get();\n} catch (ExecutionException e) {\n    if (e.getCause() instanceof NoEnoughResourceException) {\n        // backoff, free/reduce resources, then retry\n    }\n}","preventionTips":["Right-size job resource declarations to cluster capacity","Monitor cluster slot/CPU/memory utilization before submitting","Increase MAX_RETRY_TIMES for bursty workloads"],"tags":["zeta-engine","resource-allocation","no-enough-resource"],"backgroundTag":"insufficient-resources","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}