You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "hexuxu110 (via GitHub)" <gi...@apache.org> on 2025/07/28 09:58:13 UTC

[I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

hexuxu110 opened a new issue, #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841

   ### 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: 1.5.0 (Apache Release Version)
   - Backend: Hstore x nodes, HDD or SSD 
   - OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x 
   - Data Size:  xx vertices, xx edges <!-- (like 1000W 点, 9000W 边) -->
   
   
   ### Expected & Actual behavior (期望与实际表现)
   
   2025-07-28 17:56:05 [pool-15-thread-1] [ERROR] o.a.h.t.TaskManager - Exception occurred when change to master role
   java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler (org.apache.hugegraph.task.DistributedTaskScheduler and org.apache.hugegraph.task.StandardTaskScheduler are in unnamed module of loader 'app')
           at org.apache.hugegraph.task.TaskManager.onAsRoleMaster(TaskManager.java:359) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleListener.onAsRoleMaster(StandardRoleListener.java:47) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine.apply(StandardRoleElectionStateMachine.java:75) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine.lambda$start$0(StandardRoleElectionStateMachine.java:60) ~[hugegraph-core-1.5.0.jar:1.5.0]
           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) [?:?]
   2025-07-28 17:56:05 [pool-15-thread-1] [ERROR] o.a.h.m.StandardRoleListener - Server server-1 exception occurred
   java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler (org.apache.hugegraph.task.DistributedTaskScheduler and org.apache.hugegraph.task.StandardTaskScheduler are in unnamed module of loader 'app')
           at org.apache.hugegraph.task.TaskManager.onAsRoleMaster(TaskManager.java:359) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleListener.onAsRoleMaster(StandardRoleListener.java:47) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine.apply(StandardRoleElectionStateMachine.java:75) ~[hugegraph-core-1.5.0.jar:1.5.0]
           at org.apache.hugegraph.masterelection.StandardRoleElectionStateMachine.lambda$start$0(StandardRoleElectionStateMachine.java:60) ~[hugegraph-core-1.5.0.jar:1.5.0]
           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) [?:?]
   
   ### Vertex/Edge example (问题点 / 边数据举例)
   
   ```javascript
   我的rest配置
   
   restserver.url=http://0.0.0.0:8081
   gremlinserver.url=http://127.0.0.1:8181
   
   graphs=./conf/graphs
   
   # ????
   auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
   auth.admin_token=54702de7-b89e-4a80-817c-b3020e7323a0
   auth.user_tokens=user0:d75469f7-90e8-45fd-9012-7801cc0d9df6
   
   rpc.server_host=127.0.0.1
   rpc.server_port=8091
   
   rpc.remote_url=127.0.0.1:8091
   rpc.client_connect_timeout=60
   rpc.client_reconnect_period=15
   rpc.client_read_timeout=60
   rpc.client_retries=5
   rpc.client_load_balancer=consistentHash
   
   
   log.slow_query_threshold=1000
   
   server.id=server-1
   server.role=master
   ```
   
   ### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
   
   ```javascript
   
   ```


-- 
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: dev-unsubscribe@hugegraph.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3126519128

   <!-- Answer -->
   这个报错不会导致整个 HugeGraph 服务直接崩溃,核心的图存储和 PD 分布式协调功能不会受影响,服务还能正常读写数据。但凡是依赖旧 master/worker 机制的功能(比如定时任务、系统级调度任务)会因为这个异常无法正常工作,相关任务不会被调度或执行,且不会有明显提示。根本原因是 1.5.0 分布式(PD/HStore)模式下已经废弃了 master/worker 逻辑,配置或代码路径如果还触发了这部分逻辑就会报错。
   
   建议检查 rest-server.properties 等配置,去掉 server.role、server.id 等和 master/worker 相关的参数,确保只用 PD 分布式模式的推荐配置。详细原理和类似问题可以参考 [issue #2833](https://github.com/apache/incubator-hugegraph/issues/2833)。
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/0d6ee08c-35cd-4ae4-905f-eb7da92180f5?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=githu
 b)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2841)


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "hexuxu110 (via GitHub)" <gi...@apache.org>.
hexuxu110 commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3126533111

   我的配置文件rest
   restserver.url=http://0.0.0.0:8081
   gremlinserver.url=http://127.0.0.1:8181
   
   graphs=./conf/graphs
   
   # ????
   auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
   
   auth.admin_token=54702de7-b89e-4a80-817c-b3020e7323a0
   auth.user_tokens=user0:d75469f7-90e8-45fd-9012-7801cc0d9df6
   
   rpc.server_host=127.0.0.1
   rpc.server_port=8091
   
   rpc.remote_url=127.0.0.1:8091
   rpc.client_connect_timeout=60
   rpc.client_reconnect_period=15
   rpc.client_read_timeout=60
   rpc.client_retries=5
   rpc.client_load_balancer=consistentHash
   
   
   log.slow_query_threshold=1000
   
   
   但还是会报这个错误


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "koi2000 (via GitHub)" <gi...@apache.org>.
koi2000 commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3130517170

   hugegraph.properties文件中task.scheduler_type在分布式部署时需要设置为distributed
   目前的hugegraph.properties是如何设置的呢
   
   <img width="1196" height="577" alt="Image" src="https://github.com/user-attachments/assets/8344b169-ab8c-4cf4-8538-31d1b9dd71e3" />


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3126485531

   <!-- Answer -->
   This ClassCastException happens because HugeGraph 1.5.0 introduced a new distributed coordination mechanism (PD/Placement Driver) for HStore and similar backends, deprecating the old master/worker logic. In your setup, the TaskManager tries to cast a DistributedTaskScheduler to a StandardTaskScheduler during a master role change, but this cast is invalid if the scheduler is actually distributed. This is a code bug: the code assumes all schedulers are StandardTaskScheduler without checking their type, which fails in distributed/PD scenarios. 
   
   For HStore+PD, all cluster scheduling should be handled by PD, and the master/worker mechanism is no longer used. If your configuration or deployment still triggers the old master/worker logic, it can cause this error. Make sure your configuration matches the expected deployment mode for HugeGraph 1.5.0 with PD, and avoid deprecated settings like explicit master/worker roles in rest-server.properties. More details and context are discussed in [issue #2833](https://github.com/apache/incubator-hugegraph/issues/2833).
   
   No documentation or recent fixes address this specific bug, so the best workaround is to ensure your deployment and configuration fully align with the PD-based distributed mode and do not mix in legacy master/worker settings.
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ae7e7c8a-8635-4208-a53f-2f6f0beea623?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/e5e246fa-a522-4d8a-ab3c-e2588b5b501b/ask?utm_source=githu
 b)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/incubator-hugegraph/issues/2841)


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "hexuxu110 (via GitHub)" <gi...@apache.org>.
hexuxu110 commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3130669772

   backend=hstore
   serializer=binary
   
   store=hugegraph
   task.scheduler_type=distributed
   
   # pd config
   #pd.peers=127.0.0.1:8686
   pd.peers=127.0.0.1:8686,127.0.0.1:8687,127.0.0.1:8688
   
   # search config
   search.text_analyzer=jieba
   search.text_analyzer_mode=INDEX
   
   # rocksdb backend config
   rocksdb.data_path=/path/to/disk
   rocksdb.wal_path=/path/to/disk


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "Pengzna (via GitHub)" <gi...@apache.org>.
Pengzna closed issue #2841: [Bug]  java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler
URL: https://github.com/apache/incubator-hugegraph/issues/2841


-- 
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: dev-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] java.lang.ClassCastException: class org.apache.hugegraph.task.DistributedTaskScheduler cannot be cast to class org.apache.hugegraph.task.StandardTaskScheduler [incubator-hugegraph]

Posted by "hexuxu110 (via GitHub)" <gi...@apache.org>.
hexuxu110 commented on issue #2841:
URL: https://github.com/apache/incubator-hugegraph/issues/2841#issuecomment-3126508466

   @dosu 那我部署1.5.0分布式版本这块报错,影响我服务吗
   


-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org