lymerin opened a new pull request, #7482:
URL: https://github.com/apache/shenyu/pull/7482
Fixes #7463
### Problem
When all workers are busy and the pool size is below `maximumPoolSize`,
`TaskQueue.offer` is intended to return `false` so that the executor creates an
additional worker.
However, `MemorySafeTaskQueue` and `MemoryLimitedTaskQueue` inherit concrete
`offer` methods from their superclass queues. These methods take precedence
over the interface default method, preventing the eager-growth policy from
being called.
### Impact
Tasks can remain queued while the configured maximum still allows additional
workers, increasing queueing latency under load.
Both production task queue implementations are affected. Relevant callers
include shared gateway pools configured with `maximumPoolSize > corePoolSize`
and the websocket reconnect executor, which uses core/max sizes of 1/8.
### Changes
- Explicitly override `offer(Runnable)` in both task queue implementations
and delegate to `TaskQueue.super.offer`.
- Retain `doOffer` for physical enqueueing through the superclass methods,
preserving existing memory checks.
- Add parameterized tests for both queue implementations covering:
- Eager growth when the core worker is busy and queueing after reaching
the maximum.
- Queueing for an idle worker.
- Memory rejection when the maximum is reached.
- Retry enqueueing after concurrent growth reaches the maximum.
- Reuse a common executor factory in the test class.
### Validation
- Isolated execution of the same tests against the original queue
implementations — 5 passed and 4 failed, confirming that both regression
scenarios detect the issue for both queue implementations.
- 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]