[ https://issues.apache.org/jira/browse/JAMES-3803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17578529#comment-17578529 ]
Benoit Tellier commented on JAMES-3803: --------------------------------------- > No, not on master ;-) {code:java} private reactor.core.Disposable run(MailQueue queue) { scheduler = Schedulers.newBoundedElastic(configuration.getConcurrencyLevel() + 1, DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, "spooler"); // ... return Flux.from(queue.deQueue()) .flatMap(item -> handleOnQueueItem(item).subscribeOn(scheduler), configuration.getConcurrencyLevel()) .onErrorContinue((throwable, item) -> LOGGER.error("Exception processing mail while spooling {}", item, throwable)) .subscribeOn(scheduler) .subscribe(); } {code} We got rid of `Schedulers.elastic()` calls (which was quite a journey!) so now this class follows a pattern very similar to DeliveryRunnable except that the sizing of the scheduler is done taking the expected concurrency level +1. It looks like this very difference is why we don't run into this issue for JamesMailSpooler but do for DeliveryRunnable. This means there is an alternative fix in DeliveryRunnable: {code:java} public void start() { remoteDeliveryScheduler = Schedulers.newBoundedElastic(configuration.getDeliveryThreads() + 1, Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE, "RemoteDelivery"); disposable = Flux.from(queue.deQueue()) .flatMap(queueItem -> runStep(queueItem).subscribeOn(remoteDeliveryScheduler), configuration.getDeliveryThreads()) .onErrorContinue(((throwable, nothing) -> LOGGER.error("Exception caught in RemoteDelivery", throwable))) .subscribeOn(remoteDeliveryScheduler) .subscribe(); } {code} (I'm fine with your fix proposal too, btw) > DeliveryRunnable blocks email in BoundedElasticScheduler-queue if running out > of threads > ---------------------------------------------------------------------------------------- > > Key: JAMES-3803 > URL: https://issues.apache.org/jira/browse/JAMES-3803 > Project: James Server > Issue Type: Bug > Components: Remote Delivery > Affects Versions: 3.7.0 > Reporter: Adrian Bucher > Priority: Major > Attachments: jstack-of-the-bug.txt > > Time Spent: 40m > Remaining Estimate: 0h > > The DeliveryRunnable does use the same BoundedElasticScheduler (ThreadPool) > for dequeuing the messages (long running thread), and processing (delivering) > them, if lots of messages are dequeued and the BoundedElasticScheduler starts > to queue them, the one queueing behind the dequeuing - long running thread > are never processed nor delivered. > > Messages are still visible in the embedded activemq delivery queues, a > restart of the james will process them, as they will be reacknoledged by the > dequeuer. > > -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org