Skip to content

Router compareTo 方法实现引发异常 #2799

@63914578

Description

@63914578
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.6.2
  • Operating System version: Linux
  • Java version: 8

Steps to reproduce this issue

  1. 添加路由
  2. 指定相同的priority
  3. 引发异常:java.lang.IllegalArgumentException: Comparison method violates its general contract!
    查看源码 ConditionRouter、ScriptRouter、TagRouter 的 compareTo 方法实现类似,会引发同类问题。

Pls. provide [GitHub address] to reproduce this issue.

Expected Result

What do you expected from the above steps?

Actual Result

What actually happens?

If there is an exception, please attach the exception trace:

ERROR com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry  -  [DUBBO] Failed to notify for subscribe consumer://xx.xx.xx.xx/com.xxx.service.XxxService?application=xxx-service&category=providers,configurators,routers&default.check=true&dubbo=2.6.2&interface=com.xxx.service.XxxService&methods=getXxx,setXxx&owner=xxx&pid=160275&revision=3.5.9&side=consumer&timeout=10000×tamp=1542092651604, waiting for retry, cause: Comparison method violates its general contract!, dubbo version: 2.6.2, current host: xx.xx.xx
java.lang.IllegalArgumentException: Comparison method violates its general contract!
	at java.util.ComparableTimSort.mergeLo(ComparableTimSort.java:740)
	at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:477)
	at java.util.ComparableTimSort.mergeCollapse(ComparableTimSort.java:402)
	at java.util.ComparableTimSort.sort(ComparableTimSort.java:209)
	at java.util.Arrays.sort(Arrays.java:1312)
	at java.util.Arrays.sort(Arrays.java:1506)
	at java.util.ArrayList.sort(ArrayList.java:1454)
	at java.util.Collections.sort(Collections.java:141)
	at com.alibaba.dubbo.rpc.cluster.directory.AbstractDirectory.setRouters(AbstractDirectory.java:110)
	at com.alibaba.dubbo.registry.integration.RegistryDirectory.notify(RegistryDirectory.java:211)
	at com.alibaba.dubbo.registry.support.AbstractRegistry.notify(AbstractRegistry.java:414)
	at com.alibaba.dubbo.registry.support.FailbackRegistry.doNotify(FailbackRegistry.java:274)
	at com.alibaba.dubbo.registry.support.FailbackRegistry.notify(FailbackRegistry.java:260)
	at com.alibaba.dubbo.registry.zookeeper.ZookeeperRegistry.doSubscribe(ZookeeperRegistry.java:190)
	at com.alibaba.dubbo.registry.support.FailbackRegistry.subscribe(FailbackRegistry.java:190)
	at com.alibaba.dubbo.registry.integration.RegistryDirectory.subscribe(RegistryDirectory.java:159)
	at com.alibaba.dubbo.registry.integration.RegistryProtocol.doRefer(RegistryProtocol.java:305)
	at com.alibaba.dubbo.registry.integration.RegistryProtocol.refer(RegistryProtocol.java:286)
	at com.alibaba.dubbo.qos.protocol.QosProtocolWrapper.refer(QosProtocolWrapper.java:63)
	at com.alibaba.dubbo.rpc.protocol.ProtocolFilterWrapper.refer(ProtocolFilterWrapper.java:106)
	at com.alibaba.dubbo.rpc.protocol.ProtocolListenerWrapper.refer(ProtocolListenerWrapper.java:65)
	at com.alibaba.dubbo.rpc.Protocol$Adaptive.refer(Protocol$Adaptive.java)
	at com.alibaba.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:394)
	at com.alibaba.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:333)
	at com.alibaba.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:163)
	at com.alibaba.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:66)

Metadata

Metadata

Assignees

Labels

type/bugBugs to being fixed

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions