Hi all, One of our aws2-s3 routes hit an OutOfMemoryError while processing an exchange on its poll thread. After that it never polled again. The route still reported Started, the consumer health check stayed UP, and only our own monitoring eventually noticed. We can fix the OOM case with -XX:+ExitOnOutOfMemoryError, but any other Error (StackOverflowError, LinkageError, an OOM thrown by library code) still kills the consumer without any signal.
What happens (4.23.0, same on main): - ScheduledPollConsumer.doRun() catches only Exception. run() logs the Error and rethrows it. - ScheduledThreadPoolExecutor stores it in the task's future and never reschedules the task. Nothing in DefaultScheduledPollConsumerScheduler checks those futures, and isSchedulerStarted() still returns true. - errorCounter/lastError are never updated, so ScheduledPollConsumerHealthCheck stays UP. Is this intentional? If not, we'd like to send a fix. We think stopping the consumer after an Error is right, since nobody can tell what state the JVM is in after one. The problem is only that the failure isn't visible. Our proposal is a small change in doRun(): - catch Error next to the existing catch (Exception e), as the poll's cause, skipping the ExceptionHandler and pollStrategy.rollback(); - let the existing bookkeeping run, which sets lastError and increments errorCounter; - then rethrow, so run() still logs it and the task still ends. Since no later poll can reset the counters, the health check stays DOWN until the route is restarted, and orchestrators can then restart the instance. Optionally, isSchedulerStarted() could also check whether its futures are still running. Would you be open to this? We have a patch with tests ready and are happy to open the JIRA issue and the PR. Thanks, Vilmos
