JackyYangPassion opened a new issue, #2648: URL: https://github.com/apache/incubator-hugegraph/issues/2648
### Bug Type (问题类型) None ### Before submit - [X] 我已经确认现有的 [Issues](https://github.com/apache/hugegraph/issues) 与 [FAQ](https://hugegraph.apache.org/docs/guides/faq/) 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents) ### Environment (环境信息) - Server Version: master - Backend: [email protected] ### Expected & Actual behavior (期望与实际表现) # 当前问题 testGremlinJobAndCancel(org.apache.hugegraph.core.TaskCoreTest) failed when hugeserver backend with postgresql. ``` 2024-08-20 02:49:47 [server-info-db-worker-1] [INFO] o.a.h.b.s.m.MysqlSessions - Connect to the jdbc url: 'jdbc:postgresql://localhost:5432/hugegraph?loggerLevel=OFF&characterEncoding=utf-8&rewriteBatchedStatements=true&useServerPrepStmts=false&autoReconnect=true&maxReconnects=3&initialTimeout=3&useSSL=false' Error: -20 02:49:49 [task-worker-1] [ERROR] o.a.h.t.TaskCallable - Failed to save task with error "java.lang.IllegalStateException: Can't find task scheduler for graph 'standardhugegraph[hugegraph]'": {task_name=test-gremlin-job, task_progress=0, task_create=2024-08-20T02:49:37.021+0000, task_status=success, task_update=2024-08-20T02:49:49.221+0000, task_retries=0, id=1, task_type=gremlin, task_server=server-test} Error: -20 02:49:49 [task-worker-1] [ERROR] o.a.h.t.HugeTask - An exception occurred when calling done() java.lang.IllegalStateException: Can't find task scheduler for graph 'standardhugegraph[hugegraph]' at com.google.common.base.Preconditions.checkState(Preconditions.java:532) ~[guava-30.0-jre.jar:?] at org.apache.hugegraph.util.E.checkState(E.java:64) ~[hugegraph-common-1.3.0.jar:?] at org.apache.hugegraph.StandardHugeGraph.taskScheduler(StandardHugeGraph.java:1078) ~[classes/:?] at org.apache.hugegraph.task.TaskCallable.save(TaskCallable.java:107) ~[classes/:?] at org.apache.hugegraph.job.UserJob.done(UserJob.java:33) ~[classes/:?] at org.apache.hugegraph.task.HugeTask.done(HugeTask.java:362) ~[classes/:?] at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:381) ~[?:?] at java.util.concurrent.FutureTask.set(FutureTask.java:232) ~[?:?] at org.apache.hugegraph.task.HugeTask.set(HugeTask.java:378) ~[classes/:?] at java.util.concurrent.FutureTask.run(FutureTask.java:272) ~[?:?] at org.apache.hugegraph.task.HugeTask.run(HugeTask.java:307) ~[classes/:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?] at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?] at java.lang.Thread.run(Thread.java:829) [?:?] Error: Tests run: 731, Failures: 1, Errors: 10, Skipped: 48, Time elapsed: 288.808 s <<< FAILURE! - in org.apache.hugegraph.core.CoreTestSuite Error: testGremlinJobAndCancel(org.apache.hugegraph.core.TaskCoreTest) Time elapsed: 0.129 s <<< FAILURE! java.lang.AssertionError: expected:<CANCELLING> but was:<RUNNING> at org.apache.hugegraph.core.TaskCoreTest.testGremlinJobAndCancel(TaskCoreTest.java:560) ``` # 根因 主线程 和 调度线程时间差不够,当后端存储是PostgreSQL 时候 Task 状态机从SHEDULING 转变到 RUNNING 时间较长 具体日志 Sleep 100ms ``` 2024-08-23 09:22:59 [task-scheduler-1] [INFO] o.a.h.t.ServerInfoManager - Switch only_single_node to true 2024-08-23 09:22:59 [task-scheduler-1] [INFO] o.a.h.t.StandardTaskScheduler - Scheduled task '1' to server 'server-test' at 2024-08-23 09:22:59.066 2024-08-23 09:22:59 [task-scheduler-1] [INFO] o.a.h.t.StandardTaskScheduler - running task '1' on server 'server-test' at 2024-08-23 09:22:59.077 2024-08-23 09:22:59 [main] [INFO] o.a.h.t.StandardTaskScheduler - Cancel task '1' in status SCHEDULING at 2024-08-23 09:22:59.086 ``` # 解决方案 适度增大 主线程等待时间 ,修复后的结果如下 sleep 1000 ms ``` 2024-08-22 20:27:55 [task-scheduler-1] [INFO] o.a.h.t.StandardTaskScheduler - Scheduled task '1' to server 'server-test' at 2024-08-22 20:27:55.298 2024-08-22 20:27:55 [task-scheduler-1] [INFO] o.a.h.t.StandardTaskScheduler - running task '1' on server 'server-test' at 2024-08-22 20:27:55.310 2024-08-22 20:27:56 [main] [INFO] o.a.h.t.StandardTaskScheduler - Cancel task '1' in status RUNNING at 2024-08-22 20:27:56.088 ``` ### Vertex/Edge example (问题点 / 边数据举例) _No response_ ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构) _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
