You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@linkis.apache.org by Andy <an...@163.com> on 2022/06/01 06:49:21 UTC
[DISCUSS]Why is this method called several times during shutdown?
————— 2022-5-27 —————
Xi 16:31
Image 1 (can be viewed in the attachment)
Xi 16:31
Why is this method called several times during shutdown?
peacewong@WDS 16:32
Did spring trigger several times?
peacewong@WDS 16:33
Or add a judgment condition? After executing once, you cannot enter later
Xi 16:36
Image 2 (can be viewed in the attachment)
Xi 16:37
In this file, I think it is the time monitoring of spring
Xi 16:37
Image 3 (can be viewed in the attachment)
Xi 16:38
Here tryShutdown directly calls tryFailed
peacewong@WDS 16:39
Yes, this spring calls
Xi 16:41
The failed state set in failed will cause an exception to be thrown
Xi 16:41
Image 4 (can be viewed in the attachment)
Xi 16:41
Image 5 (can be viewed in the attachment)
peacewong@WDS 16:43
Has it been failed first? cause the problem here?
Xi 16:46
No, tryShutdown calls tryFailed, then tryFailed calls this.ensureAvailable(transition(NodeStatus.Failed)), and then NodeStatus.isAvailable(getStatus) is false, so an exception will be thrown
peacewong@WDS 16:48
It's just that the status is already unavailable, right? It is recommended to judge the availability first here?
Xi 16:51
It looks like the executor is not null
Xi 16:51
Image 6 (can be viewed in the attachment)
peacewong@WDS 16:59
It is normal that it is not empty, it should be called multiple times
peacewong@WDS 16:59
It is recommended to add a judgment to prevent multiple calls, you can come to a PR
————— 2022-5-27 —————
Xi 16:31
图片1(可在附件中查看)
Xi 16:31
这个方法在shutdown的时候为什么会调用好几次呢
peacewong@WDS 16:32
是不是spring触发了几次?
peacewong@WDS 16:33
或者加个判断条件?执行一次后,后面不能进入
Xi 16:36
图片2(可在附件中查看)
Xi 16:37
这个文件里面,我看是spring 的时间监听
Xi 16:37
图片3(可在附件中查看)
Xi 16:38
这里tryShutdown直接调用了tryFailed
peacewong@WDS 16:39
是的,这个spring调用的
Xi 16:41
failed里面设置的failed 状态,会导致抛出一个异常
Xi 16:41
图片4(可在附件中查看)
Xi 16:41
图片5(可在附件中查看)
peacewong@WDS 16:43
是已经先failed了吧?导致这里有问题?
Xi 16:46
不是啊,tryShutdown 调用了 tryFailed,然后tryFailed设调用了 this.ensureAvailable(transition(NodeStatus.Failed)),然后NodeStatus.isAvailable(getStatus)这个是false,所以才会抛出异常
peacewong@WDS 16:48
就是状态已经先不可用了是吧?建议这里先判断下可用状态?
Xi 16:51
看着好像是executor不是null
Xi 16:51
图片6(可在附件中查看)
peacewong@WDS 16:59
不是空是正常的,应该是调用了多次的问题
peacewong@WDS 16:59
建议加个判断,防止调用多次,可以来个PR下
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@linkis.apache.org
For additional commands, e-mail: dev-help@linkis.apache.org