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

Fix ConcurrentModificationException in Datafeed loop #475 #476

Conversation

symphony-youri
Copy link
Contributor

A ConcurrentModificationException can happen in the Datafeed (DF) loop upon startup.
The access to the listeners collection in the DF loop is not protected
and accessed by multiple threads.

Because of the for loop we need to synchronize on the list itself.

Fixes #475

A ConcurrentModificationException can happen in the Datafeed (DF) loop upon startup.
The access to the listeners collection in the DF loop is not protected
and accessed by multiple threads.

Because of the for loop we need to synchronize on the list itself.
@symphony-youri symphony-youri requested a review from a team as a code owner March 17, 2021 09:30
@symphony-youri
Copy link
Contributor Author

I'm not super happy with the sleep in the test but I could not a better way :/

});

// we want to make sure the addANewListener is started and blocking before unblocking the first listener
Thread.sleep(100);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How long does it take to execute in the end?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100ms + a few more ms for it to do the rest

Copy link
Contributor

@symphony-elias symphony-elias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@symphony-youri symphony-youri merged commit c9fc39c into finos:main Mar 17, 2021
symphony-youri added a commit to symphony-youri/symphony-api-client-java that referenced this pull request Mar 17, 2021
…#476)

A ConcurrentModificationException can happen in the Datafeed (DF) loop upon startup.
The access to the listeners collection in the DF loop is not protected
and accessed by multiple threads.

Because of the for loop we need to synchronize on the list itself.

(cherry picked from commit c9fc39c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ConcurrentModificationException in Datafeed loop
3 participants