-
Notifications
You must be signed in to change notification settings - Fork 26.5k
The remote address could not be obtained from the context after the request #11790
Copy link
Copy link
Closed
Labels
type/bugBugs to being fixedBugs to being fixed
Description
Environment
- Dubbo version: 3.1.6
- Operating System version: macOS 13.2
- Java version: 1.8.0_362
Steps to reproduce this issue
- add a filter in consumer
@Slf4j public class RpcContextFilter implements Filter { @Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { log.info("invoker url: {}:{}", invoker.getUrl().getHost(), invoker.getUrl().getPort()); Result result = invoker.invoke(invocation); log.info("remote address: {}", RpcContext.getContext().getRemoteAddress()); return result; } }
resources/META-INF/dubbo/org.apache.dubbo.rpc.FiltercontentrpcContextFilter=org.example.dubbo.filter.RpcContextFilter- dubbo consumer dependency
@DubboReference(filter = "rpcContextFilter")
- After a request, the filter prints the log as follows:
2023-03-10 19:08:45.667 INFO 77228 --- [nio-8081-exec-1] o.example.dubbo.filter.RpcContextFilter : invoker url: 10.9.0.162:50051 2023-03-10 19:08:45.817 INFO 77228 --- [nio-8081-exec-1] o.example.dubbo.filter.RpcContextFilter : remote address: null
Expected Behavior
The remote address can be obtained.
Actual Behavior
The remote address is empty
If there is an exception, please attach the exception trace:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type/bugBugs to being fixedBugs to being fixed
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Done