2021-05-26 14:57:20.387 logback [DiscoveryClient-2] ERROR c.n.discovery.TimedSupervisorTask - task supervisor timed out
java.util.concurrent.TimeoutException: null
at java.util.concurrent.FutureTask.get(FutureTask.java:205)
at com.netflix.discovery.TimedSupervisorTask.run(TimedSupervisorTask.java:63)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
收集了几个相关的url,后期再研究
https://www.cnblogs.com/meilibao/p/11358154.html
这个看起来相关性最高,被转载最多,复制出来
如何解决后端项目启动时抛出 task supervisor timed out 异常
现象描述
后端项目启动时抛出如下异常,但是该后段项目能正常启动并注册到注册中心,不影响功能使用。
2018-10-10 09:39:12.407 ERROR 8916 --- [DiscoveryClient-0] c.n.d.TimedSupervisorTask : task supervisor timed out
java.util.concurrent.TimeoutException: null
at java.util.concurrent.FutureTask.get(FutureTask.java:205) ~[?:1.8.0_172]
at com.netflix.discovery.TimedSupervisorTask.run(TimedSupervisorTask.java:63) [eureka-client-1.7.2.jar:1.7.2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_172]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_172]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [?:1.8.0_172]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [?:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
原因分析
项目启动初始化时,会启动两个定时任务,一个是向eureka注册,即心跳的线程,另一个是从eureka获取服务注册列表,即刷新注册列表缓存的线程,上述两个线程都是每30s执行一次,默认超时时间都为30s,所以当30s未执行完该任务是,便会抛出Timeout的异常。发送心跳的任务比较简单,一般不会超时。而获取注册列表的任务,耗时较久。
由于注册中心是所有服务通信的基础,所以部署在多个服务器的应用在通信时可能会比较耗时,往往会发生超时。
处理步骤
将该后端项目的 bootstrap.yml 文件中的 client.registryFetchIntervalSeconds 调大,建议调为 30。
https://stackoverflow.com/questions/37542939/problems-spring-cloud-config-and-spring-cloud-bus
这个提到是eureka的问题建议更换版本并给出了下面的链接
https://github.com/spring-cloud/spring-cloud-netflix/issues/2228
这个是相同情况的病友
https://github.com/spring-cloud/spring-cloud-netflix/issues/2812
不完全与此相关,但也提到
eureka-client-1.4.x版本存在此问题
https://zhuanlan.zhihu.com/p/45649061