-
Notifications
You must be signed in to change notification settings - Fork 859
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
fix hession maven scope and addConnectionEventProcessor concurrency problems #321
Conversation
If user do not need hessian,then he/she can not remove hessian from maven. I think it maybe unreasonable. |
I don't think so, if user need another serialization protocol, it is ok, but not necessary to delete it. |
OK, it's ok to keep hessian in dependencies. |
public class ConnectionEventListenerTest { | ||
|
||
@Test | ||
public void addConnectionEventProcessorConcurrentTest() throws InterruptedException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unit test can not reproduce the bug.
new Thread(thread).start()
: Thread is started in order. So,rpcClient.addConnectionEventProcessor(ConnectionEventType.CONNECT, (remoteAddress, connection) -> {});
may called in order. We can add a CountDownLatch beforeaddConnectionEventProcessor
method, soaddConnectionEventProcessor
can be concurrency.fail()
method is called in sub thread . We can not see it in main thread.- ArrayList maybe thread safe for add method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look at issue "Steps to reproduce"
#309
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When it change 'CopyOnWriteArrayList' to 'ArrayList', this unit test cannot throw any Exception.So I say this unit test can not reproduce the bug. Please pay attention to it. @chuailiwu @EvenLjj
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This unit test indeed can not reproduce the bug, even I add a CyclicBarrier to control all threads run in same time.
But the fix is right, there is a concurrency issue here.
If you get the list size, you will find it smaller than it shoud be when using ArrayList.
Improve UT:#324
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I tried use arrayList to reproduce the bug, but failed when there is only add operation
. When I add remove operation
in ut, it can reproduce similar problem.
Now the question become how user trigger the bug. It may be user is traversing the list, at the same time , he add processor to the list. Is it possible? or we can do something else to forbid it ? (I think it is not right to add processor when other processors are working on connections.It may cause different behavior in different connections. )
No description provided.