-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Bug Description
The heavyIOExecutor in JetCacheExecutor is explicitly configured with ThreadPoolExecutor.DiscardPolicy.
This causes a critical issue in RefreshCache: when the thread pool is busy or full, the refresh task submitted via scheduleWithFixedDelay is silently discarded.
Root Cause Analysis:
In com.alicp.jetcache.support.JetCacheExecutor.java:
// Line 88-89
heavyIOExecutor = new ScheduledThreadPoolExecutor(
10, tf, new ThreadPoolExecutor.DiscardPolicy());
The DiscardPolicy drops the task without throwing any exception.
Impact
-
Silent Failure: The caller (RefreshCache.addOrUpdateRefreshTask) has no way to know that the schedule failed.
-
Stale Data: The cache key will stop refreshing. Once the TTL expires, the business layer will read stale/dirty data (or cache miss) indefinitely.
-
No Observability: No error logs are printed, making it extremely difficult to debug in production environments.
Expected Behavior
The executor should use the default AbortPolicy (or a policy that throws exceptions). The caller (RefreshCache) should catch the RejectedExecutionException and log an error to alert that the refresh task failed to schedule.