dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] An error occurred when adding the extension dubco-metadata-report-etcd

Open glynnwei opened this issue 9 months ago • 4 comments

Pre-check

  • [X] I am sure that all the content I provide is in English.

Search before asking

  • [X] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SPI Extensions (apache/dubbo-spi-extensions)

Dubbo Version

Dubbo Java: 3.2.11 JDK: 1.8

Steps to reproduce this issue

1、maven import

<dependency>
    <groupId>org.apache.dubbo</groupId>
    <artifactId>dubbo-metadata-report-etcd</artifactId>
    <version>2.7.23</version>
</dependency>

2、error message

2024-05-07 20:29:03.365 ERROR 7088 --- [eduler-thread-6] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Failed register interface application mapping for service org.apache.dubbo.springboot.demo.idl.Greeter, dubbo version: 3.2.11, current host: 10.63.9.0, error code: 5-10. This may be caused by configuration server disconnected, go to https://dubbo.apache.org/faq/5/10 to find instructions. 
2024-05-07 20:29:08.370  INFO 7088 --- [eduler-thread-4] org.apache.dubbo.config.ServiceConfig    :  [DUBBO] Try to register interface application mapping for service org.apache.dubbo.springboot.demo.idl.Greeter, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.375  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 1. Next retry delay: 17. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.470  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 2. Next retry delay: 20. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.496  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 3. Next retry delay: 68. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.570  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 4. Next retry delay: 93. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.668  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 5. Next retry delay: 83. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.756  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 6. Next retry delay: 81. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.842  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 7. Next retry delay: 95. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.941  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 8. Next retry delay: 32. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:08.978  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 9. Next retry delay: 89. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:09.070  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 10. Next retry delay: 89. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0
2024-05-07 20:29:09.164  INFO 7088 --- [eduler-thread-4] o.a.d.r.c.m.MetadataServiceNameMapping   :  [DUBBO] Failed to publish service name mapping to metadata center by cas operation. Times: 11. Next retry delay: 55. Service Interface: org.apache.dubbo.springboot.demo.idl.Greeter. Origin Content: null. Ticket: null. Excepted context: dubbo-springboot-demo-idl-provider, dubbo version: 3.2.11, current host: 10.63.9.0

What you expected to happen

1、EtcdMetadataReport unrealized registerServiceAppMapping method returns false by default. 2、Nacos and zookeeper implement this method

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [X] Yes I am willing to submit a pull request on my own!

Code of Conduct

glynnwei avatar May 08 '24 06:05 glynnwei

@songxiaosheng PTAL

AlbumenJ avatar May 08 '24 07:05 AlbumenJ

2.x has been EOL and may be incompatible with dubbo 3.2

You can try the new version of dubbo-metadata-report-etcd, the registerServiceAppMapping method may support in the future version.

<dependency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-metadata-report-etcd</artifactId>
    <version>3.2.0</version>
</dependency>

aofall avatar May 08 '24 09:05 aofall

@aofall Thank you for your thoughts, but the error is still reported, here is my maven related information.

...
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<dubbo.version>3.2.11</dubbo.version>
<spring-boot.version>2.6.4</spring-boot.version>
...
<dependency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-registry-etcd3</artifactId>
    <version>3.2.0</version>
</dependency>
<dependency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-metadata-report-etcd</artifactId>
    <version>3.2.0</version>
</dependency>
...

Reference project: https://github.com/dubbo/dubbo-samples/tree/master/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider

glynnwei avatar May 08 '24 14:05 glynnwei

@aofall Thank you for your thoughts, but the error is still reported, here is my maven related information.

...
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<dubbo.version>3.2.11</dubbo.version>
<spring-boot.version>2.6.4</spring-boot.version>
...
<dependency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-registry-etcd3</artifactId>
    <version>3.2.0</version>
</dependency>
<dependency>
    <groupId>org.apache.dubbo.extensions</groupId>
    <artifactId>dubbo-metadata-report-etcd</artifactId>
    <version>3.2.0</version>
</dependency>
...

Reference project: https://github.com/dubbo/dubbo-samples/tree/master/1-basic/dubbo-samples-spring-boot/dubbo-samples-spring-boot-provider

okay,let's try to fix it.

songxiaosheng avatar May 09 '24 06:05 songxiaosheng

class: EtcdMetadataReport fix code:

@Override
public boolean registerServiceAppMapping(String key, String group, String content, Object ticket) {
    String appKey = toRootDir() + "mapping-data" + PATH_SEPARATOR + key + PATH_SEPARATOR + group;
    if (!etcdClient.put(appKey, content)) {
        logger.error("Failed to put service app mapping to etcd, key(appKey): " + appKey + ", value(appName): " + content);
        return false;
    }
    return true;
}

glynnwei avatar May 28 '24 13:05 glynnwei

class: EtcdMetadataReport fix code:

@Override
public boolean registerServiceAppMapping(String key, String group, String content, Object ticket) {
    String appKey = toRootDir() + "mapping-data" + PATH_SEPARATOR + key + PATH_SEPARATOR + group;
    if (!etcdClient.put(appKey, content)) {
        logger.error("Failed to put service app mapping to etcd, key(appKey): " + appKey + ", value(appName): " + content);
        return false;
    }
    return true;
}

You can submit a pr to see if it passes the ci, or I can do it for you

wcy666103 avatar May 28 '24 13:05 wcy666103

pr has been submitted https://github.com/apache/dubbo-spi-extensions/pull/380 Please close this issue as Complete

wcy666103 avatar May 30 '24 02:05 wcy666103

pr has been submitted apache/dubbo-spi-extensions#380 Please close this issue as Complete

Is it necessary to wait for pr to be completed?

glynnwei avatar May 30 '24 06:05 glynnwei

pr has been submitted apache/dubbo-spi-extensions#380 Please close this issue as Complete

Is it necessary to wait for pr to be completed?

It doesn't matter. The address stays the same and you can see it if you turn it off

wcy666103 avatar May 30 '24 08:05 wcy666103