dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

[Bug] After starting dubbo.protocol.triple.servlet.enabled=true, use http://127.0.0.1:9898/com.xxx.yyy.api.demo.NoGenericResource/queryPrice3 to request RestParameterException: Missing argument 'reqArgs' for method parameter of type [class xxx] exception

Open poazy opened this issue 6 months ago • 6 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 SDK (apache/dubbo)

Dubbo Version

Dubbo Java 3.3.4, JDK 17, MacOS 15.4.1

Steps to reproduce this issue

2025-05-09T17:12:22.750+08:00 INFO 85971 --- [yyy-servicer-demo] [3:9898-thread-8] o.a.d.r.p.t.h.CompositeExceptionHandler : [DUBBO] Http request process error: status=400, dubbo version: 3.3.4, current host: 192.168.9.133

org.apache.dubbo.rpc.protocol.tri.rest.RestParameterException: Missing argument 'reqArgs' for method parameter of type [class com.xxx.yyy.api.demo.entity.nogeneric.DsRequest] at org.apache.dubbo.rpc.protocol.tri.rest.argument.NamedValueArgumentResolverSupport.resolve(NamedValueArgumentResolverSupport.java:54) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.rest.argument.AbstractAnnotationBaseArgumentResolver.resolve(AbstractAnnotationBaseArgumentResolver.java:36) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.rest.argument.CompositeArgumentResolver.resolve(CompositeArgumentResolver.java:69) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.rest.RestHttpMessageCodec.decode(RestHttpMessageCodec.java:87) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.remoting.http12.message.HttpMessageDecoder.decode(HttpMessageDecoder.java:56) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.remoting.http12.message.DefaultListeningDecoder.decode(DefaultListeningDecoder.java:41) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.h12.DefaultHttpMessageListener.onMessage(DefaultHttpMessageListener.java:39) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.doOnData(AbstractServerTransportListener.java:183) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.rpc.protocol.tri.h12.AbstractServerTransportListener.lambda$onData$1(AbstractServerTransportListener.java:168) ~[dubbo-3.3.4.jar:3.3.4] at org.apache.dubbo.common.threadpool.serial.SerializingExecutor.run(SerializingExecutor.java:111) ~[dubbo-3.3.4.jar:3.3.4] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na] at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:39) ~[dubbo-3.3.4.jar:3.3.4] at java.base/java.lang.Thread.run(Thread.java:840) ~[na:na]

dubbo config

dubbo: application: name: ${spring.application.name}-dubbo logger: slf4j serialize-check-status: DISABLE check-serializable: false qos-enable: false qos-port: -1 protocol: host: ~ triple: verbose: true servlet: enabled: true protocols: tri: name: tri port: ${server.port} dubbo: name: dubbo port: -1 provider: retries: 0 timeout: 50000 consumer: check: false timeout: 50000 registry: address: nacos://192.168.0.95:8848?namingPushEmptyProtection=true&namingLoadCacheAtStart=false metadata-report: address: nacos://192.168.0.95:8848?namingPushEmptyProtection=true&namingLoadCacheAtStart=false config-center: address: nacos://192.168.0.95:8848?namingPushEmptyProtection=true&namingLoadCacheAtStart=false scan: base-packages: com.dsmm.yyy.servicer.demo

/**

  • @author xxx
  • @date 2020/2/27 */ public interface NoGenericResource { NoGenericRs queryPrice(NoGenericRq reqArgs); DsResponse<DemoData> queryPrice2(DsRequest<DemoData> reqArgs); DsResponse<Long> queryPrice3(DsRequest<Long> reqArgs); }

/**

  • @author xxx

  • @date 2020/2/27 */ @Slf4j @DubboService public class NoGenericResourceImpl implements NoGenericResource {

    @Override public NoGenericRs queryPrice(NoGenericRq reqArgs) { return null; }

    @Override public DsResponse<DemoData> queryPrice2(DsRequest<DemoData> reqArgs) { return null; }

    @Override public DsResponse<Long> queryPrice3(DsRequest<Long> reqArgs) { String reqStr = JSONObject.toJSONString(reqArgs); System.out.println("rq:" + reqStr); DsResponse<Long> rs = new DsResponse<>(); rs.setData(reqArgs.getData()); rs.setCode(200); rs.setMsg("OK"); return rs; }

}

idea http

POST http://127.0.0.1:9898/com.xxx.yyy.api.demo.NoGenericResource/queryPrice3 Content-Type: application/json

{ "data": 123456 }

What you expected to happen

When you start dubbo.protocol.triple.servlet.enabled=true and use a http://127.0.0.1:9898/com.xxx.yyy.api.demo.NoGenericResource/queryPrice3 request, you may get an org.apache.dubbo.rpc.protocol.tri.rest.RestParameterException: Missing argument 'reqArgs' for method parameter of type [class com.xxx.yyy.api.demo.entity.nogeneric.DsRequest] exception. For example, out of 10 requests, 4 will have this exception and 6 will be successful. seems to have an empty inputStream for body, but I don't know why. Please help me look at it. Thank you!

Anything else

No response

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

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

Code of Conduct

poazy avatar May 09 '25 09:05 poazy

@oxsean PTAL

AlbumenJ avatar May 12 '25 02:05 AlbumenJ

Hi @poazy , to help us further diagnose the missing parameter issue, could you please confirm the following:

  1. Does your project have any custom Filters, Interceptors, or AOP logic that might read the HttpServletRequest body in advance (e.g., by calling getInputStream() or getReader())?
  2. Have you introduced any third-party dependencies such as Spring Security, Actuator, or monitoring/trace libraries, which may automatically register global filters and read the request body?
  3. If you have any relevant custom Filter/AOP code, could you please provide a code snippet or a brief description of its main functionality? This information will help us determine whether the request body is consumed before Dubbo tries to parse it, which could cause the parameter missing exception. Thank you for your cooperation!

heliang666s avatar May 12 '25 11:05 heliang666s

Hi @heliang666s

1.No, my project does not have any custom Filters, Interceptors, or AOP logic that reads the HttpServletRequest body in advance (e.g., by calling getInputStream() or getReader()). 2.In my project, spring-cloud-starter-alibaba-nacos-discovery:2023.0.3.2 includes spring-security-crypto and spring-cloud-starter. In the project, spring-cloud-starter-stream-rocketmq:2023.0.3.2 includes opentelemetry-sdk-trace. The project also includes spring-boot-starter-actuator. Do these count? There are no other dependencies introduced. 3.No, I do not have any custom Filter, Interceptor, or AOP code in the project that processes or reads the HttpServletRequest body.

Thanks!

poazy avatar May 12 '25 15:05 poazy

When adding the @RequestBody annotation to the method parameter, an error occurs: {"message": "Missing argument 'reqArgs' for method parameter of type [class com.xxx.yyy.api.demo.entity.nogeneric.DsRequest]", "status": "400"}.

However, if the @RequestBody annotation is not added, no error occurs, but the method cannot receive the request body parameters.

Thanks!

poazy avatar May 13 '25 00:05 poazy

@poazy could you pls provide a demo?

oxsean avatar May 15 '25 14:05 oxsean

@oxsean

I created a Demo project using spring-cloud-alibaba: 2023.0.3.2 and dubbo: 3.3.4 to reproduce this occasional error. Thanks!

https://github.com/poazy/dubbo-rest-demo

poazy avatar May 28 '25 01:05 poazy

Has this problem been solved? Thank you!

poazy avatar Jul 22 '25 07:07 poazy

Has this problem been solved? Thank you!

HI @poazy , it may not be dubbo' bug. This may be caused by requesting an empty body.

you can use curl request the https://github.com/poazy/dubbo-rest-demo server.

request with json body {"data":123456}

curl -d '{"data":123456}' -H 'Content-Type: application/json' http://127.0.0.1:8099/com.poazy.dubbo.rest.demo.api.RestDemoService/queryPrice

got

{"code":200,"data":123456,"msg":"OK"}

request with empty body ``

curl -d '' -H 'Content-Type: application/json' http://127.0.0.1:8099/com.poazy.dubbo.rest.demo.api.RestDemoService/queryPrice

got

{"message":"Missing argument 'reqArgs' for method parameter of type [class com.poazy.dubbo.rest.demo.api.entity.DrdRQ]","status":"400"}

fantiq avatar Jul 22 '25 08:07 fantiq

Hi @fantiq ,

That's true, Neither curl nor JMeter concurrent tests have this problem.

This problem only occurs when sending requests in the .http file of IDEA. It is strange that this problem occasionally occurs! It is speculated that there is something wrong with the client processing logic in the .http file of IDEA.

Thanks!

poazy avatar Jul 23 '25 01:07 poazy