apache/shenyu · error · RejectException

no more memory can be used !

Error message

no more memory can be used !

What it means

AbortPolicy is a Rejector for Shenyu's concurrent task queues: when a producer submits an element and the queue/pool cannot accept it, reject() unconditionally throws RejectException with 'no more memory can be used !'. It signals that the caller is outpacing consumers and the configured back-pressure policy is to abort rather than block or discard.

Solutions

  1. Reduce producer rate or batch the work being enqueued.
  2. Investigate why consumers are slow (DB latency, lock contention) and fix the bottleneck.
  3. Increase queue capacity / memory budget if the burst is expected and transient.
  4. Choose a different Rejector policy (e.g. blocking or caller-runs style) if aborting is unacceptable for the workload.

Example fix

// before
new DisruptorProvider<>(..., new AbortPolicy<>(), ...); // producer aborts on burst
// after
new DisruptorProvider<>(..., new BlockingPolicy<>(), ...); // producers block instead of aborting
Defensive patterns

Strategy: try-catch

Validate before calling

if (queue.remainingCapacity() <= 0) {
    LOG.warn("queue saturated, applying backpressure before produce");
    // shed, batch, or block before producing
}

Try / catch

try {
    provider.put(event);
} catch (RejectException e) {
    LOG.error("Event dropped, queue exhausted: {}", e.getMessage());
    metrics.increment("register.queue.rejected");
}

Prevention

When it happens

Trigger: Calling put/offer on a shenyu-disruptor-style queue (e.g. the admin register event producer) whose reject policy is AbortPolicy while the queue and its memory budget are exhausted.

Common situations: Bursts of client registrations exceeding consumer throughput in shenyu-admin; consumers stuck/slow (e.g. slow DB writes) letting the in-memory queue fill; undersized queue capacity configuration.

Related errors


AI-assisted analysis of apache/shenyu@567142e072 (2026-09-12). Data as JSON: /api/errors/e2246eb2fc7c0da5. Report an issue: GitHub.

Appendix: source

Thrown at shenyu-common/src/main/java/org/apache/shenyu/common/concurrent/AbortPolicy.java:30

 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.shenyu.common.concurrent;

import java.util.Queue;

/**
 * A handler for rejected element that throws a
 * {@code RejectException}.
 */
public class AbortPolicy<E> implements Rejector<E> {

    @Override
    public void reject(final E e, final Queue<E> queue) {
        throw new RejectException("no more memory can be used !");
    }
}

View on GitHub (pinned to 567142e072)