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

使用插件2.7.7版本进行压测时,先压A接口,压完后再压B的接口;发现B的接口类路径是A的,但是方法名是B的 #122

Closed
jojoaoteman opened this issue Sep 17, 2020 · 9 comments
Labels
FAQ FAQ type/bug Something isn't working

Comments

@jojoaoteman
Copy link

image

@ningyu1
Copy link
Collaborator

ningyu1 commented Sep 18, 2020

@jojoaoteman
每个sample的数据是根据当前sample的element元素存储的,肯定不会串,除非你在同一个sample里面把接口从A修改为B。
多接口压测,建议每个接口都创建一个Dubbo Sample.

@ningyu1 ningyu1 added the FAQ FAQ label Sep 18, 2020
@glzzny
Copy link

glzzny commented Oct 9, 2020

hi,大神,我其实也遇到同样的问题。
image
image

@xchnshi
Copy link

xchnshi commented Oct 12, 2020

我也遇到了这个问题,我把DubboSample.java中的
ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() {
...

中的Constants.getAddress(this)替换为 -> Constants.getInterface(this),路径的问题就没有再出现了

@ningyu1
Copy link
Collaborator

ningyu1 commented Oct 14, 2020

我测试了一下2.7.7确实有问题,2.7.4以前是没有问题,估计是dubbov2.7.7版本对ReferenceConfigCache进行了修改,具体原因我排查一下。

@glzzny
Copy link

glzzny commented Oct 14, 2020 via email

@ningyu1 ningyu1 added the type/bug Something isn't working label Oct 14, 2020
ningyu1 added a commit to ningyu1/jmeter-plugins-dubbo that referenced this issue Oct 14, 2020
ningyu1 added a commit to ningyu1/jmeter-plugins-dubbo that referenced this issue Oct 15, 2020
@bf109f
Copy link

bf109f commented Nov 16, 2020

我也遇到了这个问题,我把DubboSample.java中的
ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() {
...

中的Constants.getAddress(this)替换为 -> Constants.getInterface(this),路径的问题就没有再出现了

我也遇到了,用楼上大佬的方法解决了

@askwu
Copy link

askwu commented Nov 30, 2020

        //2.7.7版本 referenceConfig.toString()  返回有问题待定位,返回的都是 <dubbo:reference /> 导致只缓存了第一个接口的 referenceConfig,看了下AbstractConfig这个类下的toString()方法 没看出问题,有空debug一下
       /*
        ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this), new ReferenceConfigCache.KeyGenerator() {
            @Override
            public String generateKey(ReferenceConfigBase<?> referenceConfig) {
                System.out.println("******2.7.7 key is******"+referenceConfig.toString());
                return referenceConfig.toString();
            }
		});

*/
//先改成了如下,referenceConfig的key用默认的 接口名+group+version
ReferenceConfigCache cache = ReferenceConfigCache.getCache(Constants.getAddress(this));

@askwu
Copy link

askwu commented Dec 1, 2020

public String toString() {
try {
StringBuilder buf = new StringBuilder();
buf.append("<dubbo:");
buf.append(getTagName(this.getClass()));
Method[] methods = this.getClass().getMethods();
Method[] var3 = methods;
int var4 = methods.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            Method method = var3[var5];

            try {
                if (MethodUtils.isGetter(method)) {
                    String name = method.getName();
                    String key = calculateAttributeFromGetter(name);

                    try {
                        this.getClass().getDeclaredField(key);
                    } catch (NoSuchFieldException var10) {
                        continue;
                    }

                    Object value = method.invoke(this);
                    if (value != null) {
                        buf.append(" ");
                        buf.append(key);
                        buf.append("=\"");
                        buf.append(value);
                        buf.append("\"");
                    }
                }
            } catch (Exception var11) {
                logger.warn(var11.getMessage(), var11);
            }
        }

/*
2.7.7版本和2.7.4相比 toString()方法中多了
try {
this.getClass().getDeclaredField(key);
} catch (NoSuchFieldException var10) {
continue;
}

而GenericService genericService = (GenericService) cache.get(reference);传入ReferenceConfig对象, 这些属性都是在父类ReferenceConfigBase中定义的 所以this.getClass().getDeclaredField(key)获取不到值进入catch异常了

ningyu1 added a commit that referenced this issue Dec 2, 2020
#131)

* upgrade dubbo to v2.7.8

* #122 fixed ReferenceConfigCache get diff Service to same genericService from dubbo v2.7.7

* #122 fixed ReferenceConfigCache get diffsame genericService.

* 1111

* remove Useless package

* remove Useless package

* #124 fixed Locale类型问题

* #126 fixed LocalDateTime、LocalDate、LocalTime

* fixed Locale、LocalDateTime、LocalDate、LocalTime

* downgrade dubbo to v2.7.4.1

Co-authored-by: ningyu <ningyu@jiuyescm.com>
@ningyu1 ningyu1 mentioned this issue Dec 2, 2020
4 tasks
@ningyu1
Copy link
Collaborator

ningyu1 commented Dec 2, 2020

问题修复在如下版本:

插件版本
Dubbo Jmeter Plugin v2.7.4.1
Dubbo Jmeter Plugin v2.7.8

如何选择版本?

场景:如果需要测试的Dubbo Provider存在多版本(新老版本都有)

使用Dubbo Jmeter Plugin v2.7.4.1
支持调用的dubbo服务端版本:v2.5.x、v.2.6.x、[v2.7.0-v2.7.4.1]

场景:如果需要测试的Dubbo Provider版本>=2.7.0

使用Dubbo Jmeter Plugin v2.7.8
支持调用的dubbo服务端版本:>=v2.7.0

ps. 别问为什么听话就对了。

@ningyu1 ningyu1 closed this as completed Dec 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FAQ FAQ type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants