yukon created ROCKETMQ-238: ------------------------------ Summary: Subsequent executions are suppressed when some key periodic tasks encounter an exception Key: ROCKETMQ-238 URL: https://issues.apache.org/jira/browse/ROCKETMQ-238 Project: Apache RocketMQ Issue Type: Bug Components: rocketmq-broker, rocketmq-remoting, rocketmq-store Affects Versions: 4.0.0-incubating, 4.1.0-incubating Reporter: yukon Assignee: yukon Fix For: 4.2.0-incubating
There are many scheduled tasks delegated to ScheduledExecutorService or Timer in broker. When the scheduled task encounters an exception, subsequent executions are suppressed, see: {code} /** * Creates and executes a periodic action that becomes enabled first * after the given initial delay, and subsequently with the given * period; that is executions will commence after * {@code initialDelay} then {@code initialDelay+period}, then * {@code initialDelay + 2 * period}, and so on. * If any execution of the task * encounters an exception, subsequent executions are suppressed. * Otherwise, the task will only terminate via cancellation or * termination of the executor. If any execution of this task * takes longer than its period, then subsequent executions * may start late, but will not concurrently execute. * * @param command the task to execute * @param initialDelay the time to delay first execution * @param period the period between successive executions * @param unit the time unit of the initialDelay and period parameters * @return a ScheduledFuture representing pending completion of * the task, and whose {@code get()} method will throw an * exception upon cancellation * @throws RejectedExecutionException if the task cannot be * scheduled for execution * @throws NullPointerException if command is null * @throws IllegalArgumentException if period less than or equal to zero */ public ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit); {code} So catch Throwable to avoid error canceled our key scheduled tasks. -- This message was sent by Atlassian JIRA (v6.4.14#64029)