Closed daryl-chen closed 11 months ago
I will take a look at it. BTW, are you using SOFA-RPC community version in production environment ?
I write the following code to indicate that the iterator pattern is not thread safe:
public static void testConcurrent(){
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
map.put("a","b");
Iterator<String> iterator = map.keySet().iterator();
if (iterator.hasNext()) {
map.remove("a");
String next = iterator.next();
System.out.println(map.get(next));// it prints null
}
}
More measures need to be taken to ensure thread safety. I will fix it in sofa-bolt project.
Please upgrade SOAFRPC version or bolt version. This bug is fix at https://github.com/sofastack/sofa-bolt/pull/230 . Bolt version should greater than 1.6.1.
I write the following code to indicate that the iterator pattern is not thread safe:
public static void testConcurrent(){ ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>(); map.put("a","b"); Iterator<String> iterator = map.keySet().iterator(); if (iterator.hasNext()) { map.remove("a"); String next = iterator.next(); System.out.println(map.get(next));// it prints null } }
More measures need to be taken to ensure thread safety. I will fix it in sofa-bolt project.
I will take a look at it. BTW, are you using SOFA-RPC community version in production environment ?
Yes, is there anything special I should pay attention to?
Okay, we'll do the upgrade, Thanks!
If so , you can sign your company name in https://github.com/sofastack/sofa-rpc/issues/375 .
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Describe the bug
throws a NPE when DefaultConnectionManage.scan
Actual behavior
2023-05-29 18:03:28,746 ERROR [RpcTaskScanner$1#58] [RpcTaskScannerThread-2-thread-1] Exception caught when scannings. java.lang.NullPointerException: null at com.alipay.remoting.DefaultConnectionManager.scan(DefaultConnectionManager.java:443) at com.alipay.remoting.rpc.RpcTaskScanner$1.run(RpcTaskScanner.java:56) 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:750)
Steps to reproduce
暂不知道如何复现
Minimal yet complete reproducer code (or GitHub URL to code)
Environment
java -version
): openjdk version "1.8.0_332"uname -a
): Debian GNU/Linux 11