Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isConsumerSide 报 null 问题 #10704

Closed
1 task
JavaLionLi opened this issue Oct 8, 2022 · 18 comments
Closed
1 task

isConsumerSide 报 null 问题 #10704

JavaLionLi opened this issue Oct 8, 2022 · 18 comments
Labels
type/bug Bugs to being fixed

Comments

@JavaLionLi
Copy link
Contributor

  • 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: linux
  • Java version: 1.8

Steps to reproduce this issue

image
image

不应该报null的地方 却报null了 好多原先好使的 现在都不好使了 3.0.9无问题

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

Expected Behavior

Actual Behavior

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

Just put your stack trace here!
@JavaLionLi JavaLionLi added the type/bug Bugs to being fixed label Oct 8, 2022
@JavaLionLi
Copy link
Contributor Author

image
只要是injvm 获取url全都是null 导致后续所有操作全都报null

@JavaLionLi
Copy link
Contributor Author

image

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

org/apache/dubbo/rpc/filter/ContextFilter.java:95 看一下这个地方有没有设置进去

@JavaLionLi
Copy link
Contributor Author

org/apache/dubbo/rpc/filter/ContextFilter.java:95 看一下这个地方有没有设置进去

image
这个只有PROVIDER有效 我现在想在CONSUMER打日志 拿不到数据

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66
consumer 应该是这个

@JavaLionLi
Copy link
Contributor Author

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

你的 order 是不是 min-value

@JavaLionLi
Copy link
Contributor Author

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

你的 order 是不是 min-value

并不是 没有设置order用的默认的

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

你的 order 是不是 min-value

并不是 没有设置order用的默认的

Filter 整个定义脱敏后发一下

@JavaLionLi
Copy link
Contributor Author

JavaLionLi commented Oct 8, 2022

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

你的 order 是不是 min-value

并不是 没有设置order用的默认的

Filter 整个定义脱敏后发一下

/**
 * dubbo日志过滤器
 *
 * @author Lion Li
 */
@Slf4j
@Activate(group = {CommonConstants.PROVIDER, CommonConstants.CONSUMER})
public class DubboRequestFilter implements Filter {

    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        String client = CommonConstants.PROVIDER;
        if (RpcContext.getServiceContext().isConsumerSide()) {
            client = CommonConstants.CONSUMER;
        }
        String baselog = "Client[" + client + "],InterfaceName=[" + invocation.getInvoker().getInterface().getSimpleName() + "],MethodName=[" + invocation.getMethodName() + "]";
        log.info("DUBBO - 服务调用: {},Parameter={}", baselog, invocation.getArguments());

        long startTime = System.currentTimeMillis();
        // 执行接口调用逻辑
        Result result = invoker.invoke(invocation);
        // 调用耗时
        long elapsed = System.currentTimeMillis() - startTime;
        // 如果发生异常 则打印异常日志
        if (result.hasException() && invoker.getInterface().equals(GenericService.class)) {
            log.error("DUBBO - 服务异常: {},Exception={}", baselog, result.getException());
        } else {
            log.info("DUBBO - 服务响应: {},SpendTime=[{}ms]", baselog, elapsed);
        }
        return result;
    }

}

@JavaLionLi
Copy link
Contributor Author

org/apache/dubbo/rpc/cluster/filter/support/ConsumerContextFilter.java:66 consumer 应该是这个

还没等执行到这个类的时候 就已经执行上面的方法并报错了

你的 order 是不是 min-value

并不是 没有设置order用的默认的

Filter 整个定义脱敏后发一下

就拦截打印了一下日志 很简单的 filter

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

应该和 #9645 这个 PR 有关系,导致 Dubbo Cluster Filter 没生效,我看下是哪里导致的

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 8, 2022

#10707 这个我先 revert 了

@AlbumenJ
Copy link
Member

AlbumenJ commented Oct 9, 2022

Will be fixed in 3.0.13, 3.1.2

@AlbumenJ AlbumenJ closed this as completed Oct 9, 2022
@pengzhenlong
Copy link

请问下最后是用什么方式解决的,我是在切换成非admin用户使用时,debug发现这里报错,麻烦告知一下

@JavaLionLi
Copy link
Contributor Author

Will be fixed in 3.0.13, 3.1.2

升级 3.1.2 依旧报这个错 你上面提交的pr在3.1.2版本里也没有找到 还是本地调用的问题 根本就没有改正过来
image

@JavaLionLi
Copy link
Contributor Author

@AlbumenJ

AlbumenJ added a commit to AlbumenJ/dubbo-samples that referenced this issue Nov 21, 2022
@AlbumenJ
Copy link
Member

之前修复是在 3.0 分支做的,发版的时候没有合并到新分支。
这个已经修复 ae0a371

对应的集成测试用例已经完善,https://github.com/apache/dubbo-samples/pull/586。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

3 participants