vert-x3 / vertx-service-proxy

EventBus Proxy generation
Apache License 2.0
67 stars 58 forks source link

Unstable action header in service proxy #132

Closed plause closed 2 years ago

plause commented 2 years ago

Questions

Event bus proxies (generated by 'vertx-codegen') construct delivery options for every method call by copying from the defaults (provided by the proxy builder) and add the method name to the action header.

Unfortunately, headers in delivery options are not deep-copied, making the action header grow at every invocation. And the remote (proxy handler) only takes the first value, so any further calls are routed to the method of the first one, which leads to:

1, action header grows unlimited; 2, calls to remote may be misdirected; 3, calls to remote may fail due to parameters/return type mismatch;

Workaround:

Don't set any or empty headers (leave it null) at the initial delivery options when build service proxies.

Version

4.2.6

Context

create service proxy with delivery options and headers.

Do you have a reproducer?

https://github.com/plause/vertx-service-proxy-unstable-action-header

Steps to reproduce

  1. see tests in TestMainService

Extra

https://github.com/vert-x3/vertx-service-proxy/blob/0bef443030919547e9f96bbc0b8d52e0d73a8683/src/main/java/io/vertx/serviceproxy/generator/ServiceProxyGen.java#L137-L138

plause commented 2 years ago

I had created a pull request #133 for this.