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

Getting a ConcurrentModificationException sometimes #299

Open
ssimon opened this issue Jan 15, 2014 · 1 comment
Open

Getting a ConcurrentModificationException sometimes #299

ssimon opened this issue Jan 15, 2014 · 1 comment

Comments

@ssimon
Copy link

ssimon commented Jan 15, 2014

Don't really know when this is happening, but I see this error in the logs from time to time:

2014-01-15 17:21:25,040 [I/O dispatcher 1] WARN com.findwise.hydra.SerializationUtils - A ConcurrentModificationException was caught during serialization. Trying again!

It seems to resolve it self, but warning tend to be bad anyway..

@jwestberg
Copy link
Contributor

This is because the cache is essentially an in-memory database that contains a copy of each document. A stage may write back changes to that document, modifying it in memory, while that same document was already being serialized out to a second stage. This causes a ConcurrentModificationException to be thrown by the serialization code. Simply trying again would solve the issue in most cases.

Essentially, it provides some transactional safety to the document retrieval, guaranteeing that a stage will always get a consistent view of the document it is getting, and not some but not all changes made by a concurrent update. In a traditional pipeline where a document is only eligible to be processed by a single stage at a time, this condition can never happen.

Might make sense to lower the log level of the condition, or implement a shared read-write lock on the document being serialized or updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants