dubbo Provider export tri protocol with declare context-path, consumer got a "Bad path format xxx" exception

wz1wpwve  于 4个月前  发布在  Go
关注(0)|答案(9)|浏览(56)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 3.1.1
  • Operating System version: win10
  • Java version: 1.8

Steps to reproduce this issue

  1. 提供者声明 dubbo.protocols.tri.contextpath: ${spring.application.name}
  2. 消费者以tri协议调用 @DubboReference(protocol = "tri")
  3. 消费者收到报错 org.apache.dubbo.rpc.StatusRpcException: UNIMPLEMENTED : Bad path format:/context-path/com.a.b/c

定位报错代码处: org.apache.dubbo.rpc.protocol.tri.stream.TripleServerStream.ServerTransportObserver#processHeader

// ......  省略
     //   path = /context-path/com.a.b/c
      String[] parts = path.split("/");
     // parts.length = 4 报错
      if (parts.length != 3) {
          responseErr(TriRpcStatus.UNIMPLEMENTED.withDescription("Bad path format:" + path));
          return;
      }
     // ...... 省略

上述代码限制了长度一定为3,实际可能为4

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

Expected Behavior

兼容掉声明了context-path的情况

Actual Behavior

未兼容

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

Just put your stack trace here!
wlwcrazw

wlwcrazw2#

I would like to ask, what purpose do you want to use this configuration for?

c7rzv4ha

c7rzv4ha3#

It is not a bug . Path is defined here https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md

It seems that the triple design does not support context-path at the beginning.

xnifntxz

xnifntxz4#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

sauutmhj

sauutmhj5#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

It seems that there are two solutions

  • Make a protocol judgment on the configuration, ignore or report an error for triple
  • The server is compatible, if there are 4 parts, ignore the first part
kqlmhetl

kqlmhetl6#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

It seems that there are two solutions

  • Make a protocol judgment on the configuration, ignore or report an error for triple
  • The server is compatible, if there are 4 parts, ignore the first part

Just ignore context-path when read path from url

3phpmpom

3phpmpom7#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

It seems that there are two solutions

  • Make a protocol judgment on the configuration, ignore or report an error for triple
  • The server is compatible, if there are 4 parts, ignore the first part

Just ignore context-path when read path from url

Well, I agree, but need a log to let the user know.

b5lpy0ml

b5lpy0ml8#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

It seems that there are two solutions

  • Make a protocol judgment on the configuration, ignore or report an error for triple
  • The server is compatible, if there are 4 parts, ignore the first part

Just ignore context-path when read path from url

Well, I agree, but need a log to let the user know.

yep,Would you like to pr to fix it?

zxlwwiss

zxlwwiss9#

I would like to ask, what purpose do you want to use this configuration for?

Some of our old services initially only supported jsonrpc, http, and rest protocols. The simple way is to directly modify the protocol to triple without deleting the context-path.

It seems that there are two solutions

  • Make a protocol judgment on the configuration, ignore or report an error for triple
  • The server is compatible, if there are 4 parts, ignore the first part

Just ignore context-path when read path from url

Well, I agree, but need a log to let the user know.

yep,Would you like to pr to fix it?

ok,I will fix it.

相关问题