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.15] AccessLog打印异常会导致异常日志重复输出 #9953

Closed
1 task done
sunhk opened this issue Apr 22, 2022 · 1 comment
Closed
1 task done

[2.7.15] AccessLog打印异常会导致异常日志重复输出 #9953

sunhk opened this issue Apr 22, 2022 · 1 comment
Labels
help wanted Everything needs help from contributors type/bug Bugs to being fixed
Milestone

Comments

@sunhk
Copy link

sunhk commented Apr 22, 2022

  • I have searched the issues of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: 2.7.15
  • Operating System version: Linux
  • Java version: 1.8

Steps to reproduce this issue

若存在类使com.alibaba.fastjson.JSON.toJSONString调用异常,如:

public class Example implements Serializable {
    private static final long serialVersionUID = 493475700851136978L;
    private String name;
    public String getName() throws IllegalAccessException {
        if(name==null){
             throw new IllegalAccessException("name is undefined");
        }
        return name;
    }
    public static void main(String[] args) {
        System.out.println(JSON.toJSONString(new Example()));
    }
}

将Example作为provider方法参数。

Expected Behavior

access log正常打印,或只报一次异常

Actual Behavior

org.apache.dubbo.rpc.filter.AccessLogFilter#writeLogQueueToFile中processWithServiceLogger或processWithAccessKeyLogger方法调用异常,无法及时清理logQueue,使相同异常重复打印,阻断queue中后续日志打印,log queue也会随着使用逐渐充满。
dubbo 3.0未进行测试,但看代码逻辑是一样的

com.alibaba.fastjson.JSONException: write javaBean error, fastjson version 1.2.70, class test.Example, method : getName
	at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:539)
	at com.alibaba.fastjson.serializer.JavaBeanSerializer.write(JavaBeanSerializer.java:149)
	at com.alibaba.fastjson.serializer.JSONSerializer.write(JSONSerializer.java:285)
	at com.alibaba.fastjson.JSON.toJSONString(JSON.java:758)
	at com.alibaba.fastjson.JSON.toJSONString(JSON.java:696)
	at com.alibaba.fastjson.JSON.toJSONString(JSON.java:661)
	at org.apache.dubbo.rpc.support.AccessLogData.getLogMessage(AccessLogData.java:242)
	at org.apache.dubbo.rpc.filter.AccessLogFilter.processWithServiceLogger(AccessLogFilter.java:175)
	at org.apache.dubbo.rpc.filter.AccessLogFilter.writeLogQueueToFile(AccessLogFilter.java:133)
	at org.apache.dubbo.rpc.filter.AccessLogFilter.writeLogToFile(AccessLogFilter.java:153)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalAccessException: name is undefined
@sunhk sunhk added the type/bug Bugs to being fixed label Apr 22, 2022
TigerTurbo pushed a commit to TigerTurbo/dubbo that referenced this issue Apr 22, 2022
TigerTurbo pushed a commit to TigerTurbo/dubbo that referenced this issue Apr 22, 2022
TigerTurbo pushed a commit to TigerTurbo/dubbo that referenced this issue Apr 22, 2022
@AlbumenJ AlbumenJ added help wanted Everything needs help from contributors good first issue labels Apr 25, 2022
@106umao 106umao mentioned this issue Apr 28, 2022
8 tasks
@106umao
Copy link

106umao commented Apr 28, 2022

@i will solve it !

@chickenlj chickenlj added this to the 3.0.8 milestone May 7, 2022
chickenlj pushed a commit that referenced this issue May 7, 2022
…n occurs in the method processWithAccessKeyLogger(#9978)

Fixes issue #9953
@chickenlj chickenlj modified the milestones: 3.0.8, 2.7.16 May 7, 2022
@sunhk sunhk closed this as completed May 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Everything needs help from contributors type/bug Bugs to being fixed
Projects
None yet
Development

No branches or pull requests

4 participants