bug: plugin http-dubbo doesn't work
Current Behavior
using dubbo-samples-tengine project as test case Service: org.apache.dubbo.samples.tengine.DemoService Method: test(Integer a)
Plugin Config
"http-dubbo": {
"method": "test",
"params_type_desc": "Ljava/lang/Integer",
"serialized": true,
"service_name": "org.apache.dubbo.samples.tengine.DemoService",
"service_version": "1.0.0"
}
12:45:54.760 |-INFO [main] bo.registry.integration.RegistryProtocol:1080 -| [DUBBO] Registered dubbo service org.apache.dubbo.samples.tengine.DemoService:1.0.0 url dubbo://172.22.15.109:20880/org.apache.dubbo.samples.tengine.DemoService?application=demo-provider&deprecated=false&dubbo=2.0.2&dynamic=true&generic=false&interface=org.apache.dubbo.samples.tengine.DemoService&methods=dubbo2Http,tengineDubbo,tengineTest,test&prefer.serialization=fastjson&release=3.3.0&revision=1.0.0-SNAPSHOT&serialization=fastjson&service-name-mapping=true&side=provider×tamp=1728103546122&version=1.0.0 to registry multicast://224.5.6.7:1234/org.apache.dubbo.registry.RegistryService?REGISTRY_CLUSTER=default&application=demo-provider&dubbo=2.0.2&executor-management-mode=isolation&file-cache=true&pid=139371®ister=false&release=3.3.0×tamp=1728103545636, dubbo version: 3.3.0, current host: 172.22.15.109
12:45:54.794 |-INFO [main] org.apache.dubbo.metadata.MetadataInfo:204 -| [DUBBO] metadata revision changed: null -> 5b7fa52cfc7bea1e69d11c9535aa9706, app: demo-provider, services: 1, dubbo version: 3.3.0, current host: 172.22.15.109
12:45:54.816 |-INFO [main] ubbo.config.deploy.DefaultModuleDeployer:380 -| [DUBBO] Dubbo Module[1.1.1] has completed., dubbo version: 3.3.0, current host: 172.22.15.109
12:45:54.816 |-INFO [main] config.deploy.DefaultApplicationDeployer:1360 -| [DUBBO] Dubbo Application[1.1](demo-provider) has completed., dubbo version: 3.3.0, current host: 172.22.15.109
dubbo service started
12:46:41.267 |-INFO [NettyServerWorker-5-1] ting.transport.netty4.NettyServerHandler:75 -| [DUBBO] The connection [id: 0x72ed37e0, L:/172.22.15.109:20880 - R:/172.22.15.111:34860] of 172.22.15.111:34860 -> 172.22.15.109:20880 is established., dubbo version: 3.3.0, current host: 172.22.15.109
12:46:41.286 |-INFO [NettyServerWorker-5-1] ache.dubbo.rpc.protocol.dubbo.DubboCodec:248 -| [DUBBO] Because thread pool isolation is enabled on the dubbo protocol, the body can only be decoded on the io thread, and the parameter[decode.in.io.thread] will be ignored, dubbo version: 3.3.0, current host: 172.22.15.109
12:46:41.290 |-WARN [NettyServerWorker-5-1] c.protocol.dubbo.DecodeableRpcInvocation: -| [DUBBO] Decode rpc invocation failed: Unrecognized serialize type from consumer: 6, dubbo version: 3.3.0, current host: 172.22.15.109, error code: 4-20. This may be caused by , go to https://dubbo.apache.org/faq/4/20 to find instructions.
java.io.IOException: Unrecognized serialize type from consumer: 6
at org.apache.dubbo.remoting.transport.CodecSupport.getSerialization(CodecSupport.java:96) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:129) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:106) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:200) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:137) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:92) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:59) ~[dubbo-3.3.0.jar:3.3.0]
at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:103) ~[dubbo-3.3.0.jar:3.3.0]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved(ByteToMessageDecoder.java:266) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:536) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) ~[netty-codec-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) ~[netty-transport-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.87.Final.jar:4.1.87.Final]
at java.lang.Thread.run(Thread.java:829) ~[?:?]
Expected Behavior
Return right resposne
Error Logs
http-dubbo exits with http status code 500, client: 47.236.83.16, server: _, request: "POST /DemoService/test HTTP/2.0",
Steps to Reproduce
- deploy the 3.10.0 follow official website
- Download dubbo-sample-tegnine project, add test method in DemoService
- setup http-dubbo the plugin in APISIX
Environment
- APISIX version (run
apisix version): 3.10.0 - Operating system (run
uname -a): 5.14.0-427.37.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Sep 24 17:44:03 EDT 2024 x86_64 x86_64 x86_64 GNU/Linux - OpenResty / Nginx version (run
openresty -Vornginx -V): 1.25.3 - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info): 1.5.16 - APISIX Dashboard version, if relevant:
- Plugin runner version, for issues related to plugin runners:
- LuaRocks version, for installation issues (run
luarocks --version): 3.8.0
@ShenFeng312 can you take a look?
Find another bug. The http-dubbo doen't work with latest version of dubbo-serialization-fastjson extentsion. Actually, only works with 1.0.1 version
There are the detail exception from other version.
{"@timestamp":"2024-10-08T13:13:55.650Z","traceId":"","timestamp":"2024-10-08 21:13:55.650","thread":"NettyServerWorker-3-3","level":"WARN","class":"o.a.d.rpc.protocol.dubbo.DecodeableRpcInvocation","rest":" [DUBBO] Decode rpc invocation failed: org.apache.dubbo.common.serialize.SerializationException: java.lang.IllegalArgumentException: deserialize failed. expected read length: 573713968 but actual read: 97, dubbo version: 3.3.0, current host: 172.22.15.144, error code: 4-20. This may be caused by , go to https://dubbo.apache.org/faq/4/20 to find instructions. ","exception":"java.io.IOException: org.apache.dubbo.common.serialize.SerializationException: java.lang.IllegalArgumentException: deserialize failed. expected read length: 573713968 but actual read: 97\n\tat org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper.handleToIOException(DefaultSerializationExceptionWrapper.java:353)\n\tat org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper.access$000(DefaultSerializationExceptionWrapper.java:27)\n\tat org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper$ProxyObjectInput.readUTF(DefaultSerializationExceptionWrapper.java:136)\n\tat org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:132)\n\tat org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:106)\n\tat org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:200)\n\tat org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:137)\n\tat org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:92)\n\tat org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:59)\n\tat org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalDecoder.decode(NettyCodecAdapter.java:103)\n\tat io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n\tat io.netty.handler.codec.ByteToMessageDecoder.handlerRemoved(ByteToMessageDecoder.java:266)\n\tat io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:536)\n\tat io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)\n\tat io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)\n\tat io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)\n\tat io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)\n\tat io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)\n\tat io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724)\n\tat io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650)\n\tat io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562)\n\tat io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)\n\tat io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)\n\tat io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)\n\tat java.base/java.lang.Thread.run(Thread.java:829)\nCaused by: org.apache.dubbo.common.serialize.SerializationException: java.lang.IllegalArgumentException: deserialize failed. expected read length: 573713968 but actual read: 97\n\t... 36 common frames omitted\nCaused by: java.lang.IllegalArgumentException: deserialize failed. expected read length: 573713968 but actual read: 97\n\tat org.apache.dubbo.common.serialize.fastjson.FastJsonObjectInput.readObject(FastJsonObjectInput.java:53)\n\tat org.apache.dubbo.common.serialize.fastjson.FastJsonObjectInput.readObject(FastJsonObjectInput.java:43)\n\tat org.apache.dubbo.common.serialize.DefaultJsonDataInput.readUTF(DefaultJsonDataInput.java:63)\n\tat org.apache.dubbo.common.serialize.DefaultSerializationExceptionWrapper$ProxyObjectInput.readUTF(DefaultSerializationExceptionWrapper.java:134)\n\t... 33 common frames omitted\n"} {"@timestamp":"2024-10-08T13:14:01.616Z","traceId":"","timestamp":"2024-10-08 21:14:01.616","thread":"NettyServerWorker-3-3","level":"WARN","class":"org.apache.dubbo.remoting.transport.AbstractServer","rest":" [DUBBO] All clients has disconnected from /172.22.15.144:20882. You can graceful shutdown now., dubbo version: 3.3.0, current host: 172.22.15.144, error code: 99-0. This may be caused by unknown error in remoting module, go to https://dubbo.apache.org/faq/99/0 to find instructions. ","exception":""}
verify the issue, all the http-dubbo content is not compatible with new version.
dubbo-fastjson-extension 1.0.1, read by line
public byte[] readBytes() throws IOException { return this.readLine().getBytes(); }
but they changed the way to read bytes post 1.0.1, now is already version 3.3.0.
length content
public byte[] readBytes() throws IOException { int length = this.is.read(); byte[] bytes = new byte[length]; int read = this.is.read(bytes, 0, length); if (read != length) { throw new IllegalArgumentException("deserialize failed. expected read length: " + length + " but actual read: " + read); } else { return bytes; } }
please update the bytes format, 1.0.1 is the way to old.
meanwhile there is bug in the previous version if there is \n in json data, then all the serialization will failed
java.io.IOException: Unrecognized serialize type from consumer: 6
The reason for this error is that you did not configure the serialization method according to the documentation.
but they changed the way to read bytes post 1.0.1, now is already version 3.3.0.
I have verified this on Dubbo 3.x, and there are no issues with the serialization. Could you provide a more complete example?
meanwhile there is bug in the previous version if there is
\nin json data, then all the serialization will failed
I don't think so. In Dubbo's JSON serialization, the \n within strings will be escaped. Also, please use a compressed JSON format and avoid adding \n between fields.
@qiyuan4f
@qiyuan4f
If you have any new questions, you can open issue again.