Hi Thomas,

thanks for the detailed report. I can reproduce it and pushed a test case as a 
draft PR: https://github.com/apache/tomee/pull/3090

I also ran it against a snapshot of your Geronimo PR. Both cases fail, and in 
both the problem is in activemq-ra. The code involved is the same in 10.2.0 and 
on main:

1. Without your patch, the RejectedExecutionException leaves the ServerSession 
marked as "running" with no thread behind it. With maxSessions=1 the consumer 
is gone for good, and nothing is logged.
2. With your patch, the RA handles the failure and tries to reconnect, but it 
schedules the reconnect on the same, still full WorkManager. That is rejected 
too ("Work Manager did not accept work"), and the endpoint never tries again. 
That is why the patched version behaves the same for you.

So your Geronimo fix is correct, but it isn't enough on its own. The RA needs 
to retry the reconnect instead of giving up. I’ think you should open an issue 
with ActiveMQ and link the reproducer.

Until there's a fix, enough headroom in the RA thread pool or a long 
OfferTimeout avoids both problems, because work then waits instead of being 
rejected.

Gruß
Richard

> Am 14.10.2026 um 10:13 schrieb Thomas Butz via dev <[email protected]>:
> 
> 10.2.0
> 
> ----- Ursprüngliche Mail -----
> Von: "Richard Zowalla" <[email protected]>
> An: "dev" <[email protected]>
> Gesendet: Mittwoch, 14. Oktober 2026 10:11:37
> Betreff: Re: MDB pool drops instances on RejectedExecutionException
> 
> Version?
> 
>> Am 14.10.2026 um 10:10 schrieb Thomas Butz via dev <[email protected]>:
>> 
>> Hey all,
>> 
>> We're currently investigating a load-induced problem with our MDBs, which is 
>> causing some issues. To summarise the chain of events briefly:
>> 
>> - The thread pool of our Resource Adapter is exhausted, which is most likely 
>> caused by interaction with an external system. This causes MDB message 
>> processing to stall.
>> - The RejectedExecutionHandler of the GeronimoWorkManager threadpool then 
>> kicks in and throws a RejectedExecutionException after hitting the timeout.
>> - The ActiveMQ consumer tied to the MDB is recreated or in case of 
>> maxSessions=1 completely vanishes
>> - The external system recovers, allowing the thread pool to catch up.
>> 
>> The problem is that we also have two MDBs with maxSessions = 1. If one of 
>> these dies, it is apparently never recreated. Later on, we are hit by a 
>> jakarta.jms.ResourceAllocationException because the topic fills up without 
>> its consumer.
>> 
>> Initially, I thought this was caused by the GeronimoWorkManager throwing a 
>> RejectedExecutionException instead of a WorkRejectedException, which I 
>> reported upstream: https://issues.apache.org/jira/browse/GERONIMO-6911.
>> 
>> However, even with the patched version, we observe the same behaviour.
>> 
>> -- 
>> Thomas Butz
>> OPTITOOL GmbH

Reply via email to