lymerin opened a new pull request, #7495: URL: https://github.com/apache/shenyu/pull/7495
Fixes #7462 ### Problem - Increasing the memory limit does not notify producers already waiting for budget. - After shrinking the limit below current usage, `clear()` resets usage to zero, but `reset()` decides whether to notify using the pre-reset usage. ### Impact Eligible producers remain blocked despite sufficient budget after a limit increase or shrink-and-clear. `MemoryLimitedTaskQueue` inherits the affected queue behavior. With the shared pool enabled (`shenyu.shared-pool.enable=true` or omitted) and `shenyu.shared-pool.max-work-queue-memory` configured, `ShenyuThreadPoolConfiguration#memoryLimitedTaskQueue` creates this queue for the gateway's shared thread pool. The reproduced stall concerns its blocking producer API; normal executor submissions use non-blocking `offer()`. ### Changes - Make `memoryLimit` volatile for existing reads outside the admission lock. - Update the limit and call `signalAll()` under the existing admission lock. - Reset usage and call `signalAll()` under the existing full lock. - Add two regression tests for expansion and clearing after shrinking to 21. Both place a larger waiter before a smaller one, verify only the eligible request completes, and check usage, queue size, and worker termination. - Preserve both test-body and termination-check failures using `assertAll()`. ### Validation - All 11 tests in MemoryLimitedLinkedBlockingQueueTest passed with zero failures, errors, or skipped tests. - Checkstyle passed with zero violations. ### Checklist Make sure that: - [x] You have read the [[contribution guidelines](https://shenyu.apache.org/community/contributor-guide)](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [x] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true`. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
