XLPE opened a new issue, #51115: URL: https://github.com/apache/doris/issues/51115
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues. ### Version 2.1.8 ### What's Wrong? We suddenly encountered an issue where all export jobs could not be created , and even after waiting for a day, the problem still persists. Therefore, i traced the program. When the export publishes a task, it will call the following function tryPublishTask. ``` public Long addMemoryTask(TransientTaskExecutor executor) throws JobException { Long taskId = executor.getId(); taskExecutorMap.put(taskId, executor); disruptor.tryPublishTask(taskId); LOG.info("add memory task, taskId: {}", taskId); return taskId; } ......... public void tryPublishTask(Long taskId) throws JobException { if (isClosed) { log.info("tryPublish failed, disruptor is closed, taskId: {}", taskId); return; } // We reserve two slots in the ring buffer // to prevent it from becoming stuck due to competition between producers and consumers. if (disruptor.getRingBuffer().hasAvailableCapacity(2)) { disruptor.publishEvent(TRANSLATOR, taskId, 0L, TaskType.TRANSIENT_TASK); } else { throw new JobException("There is not enough available capacity in the RingBuffer."); } } ``` The above disruptor.getRingBuffer().hasAvailableCapacity(2) always returns false. And taskExecutorMap is empty. I traced the hasAvailableCapacity function and found that there might be a boundary bug in Disruptor. ``` private boolean hasAvailableCapacity(int requiredCapacity, boolean doStore) { // nextValue = 3510 long nextValue = this.nextValue; // wrapPoint = 3510 + 2 - 1024 = 2488 long wrapPoint = nextValue + (long) requiredCapacity - (long) this.bufferSize; // cachedValue = 2487 long cachedGatingSequence = this.cachedValue; if (wrapPoint > cachedGatingSequence || cachedGatingSequence > nextValue) { if (doStore) { this.cursor.setVolatile(nextValue); } // minSequence = 2487 long minSequence = Util.getMinimumSequence(this.gatingSequences, nextValue); this.cachedValue = minSequence; // 2488 > 2487, return false if (wrapPoint > minSequence) { return false; } } return true; } ``` It's a bit unusual that there is a no contiguous minimum value of 2487 in gatingSequences.  You can read the runtime values of the variables in the attachment. [0521 - stack.log](https://github.com/user-attachments/files/20361861/0521.-.stack.log) ### What You Expected? Given that the current Disruptor implementation is overly complex and makes bug tracking challenging, and considering that this use case only involves a basic producer-consumer scenario, I recommend refactoring the logic to ensure the reliability of queue production and consumption. ### How to Reproduce? it only occurs occasionally online, i am not sure how to reproduce it. ### Anything Else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org