Bug: Favorite Node Adder - ConcurrentModificationException

I’ve just experienced an error when I double-clicked a node in the Most frequently used nodes from the Favorite Nodes view. The node added to the workflow successfully while an error dialog displayed as follows:

image

An internal error occurred during: “Favorite Node Adder”.
java.util.ConcurrentModificationException

This looks like KNIME tried to add the node I just clicked back to the list of the recently used nodes while the collection was being iterated at the same time. This is an exact situation that usually results in ConcurrentModificationException.

I cannot replicate this locally (and the iteration is not occurring on the node list, but rather some listeners) - but i can see in the code why this has the potential to occur. I’ve filed a bug. (internal: AP-13945)

3 Likes

Hi @quaeler,

Yes, listeners. It sounds very likely.

As a job interview consultant, I liked asking candidates for an implementation of notifyListeners method of a Java SE Bean. The trick is that a listener could try to unregister itself while being notified, which would make the notifyListeners method fail if it was implemented as a simple for-each or while-iterator-hasnext loop over a collection of listeners. A solution is either iterating over an ad-hoc created copy of the original collection or using a concurrent-access-safe implementation of the java.util.Collection interface, e.g. java.util.concurrent.CopyOnWriteArrayList to store the listeners.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Hi @jan_lender,

We weren’t able to reproduce the issue locally. Nonetheless, the fix implemented by @quaeler is now available on our nightly build. Can you reliably reproduce the issue? If so, may I kindly ask you to verify that the issue is indeed resolved in our nightly build?

Thanks for bringing it to our attention in the first place.

3 Likes

@jan_lender, the topic is available for me. You can try to answer.

2 Likes

Hi @marc-bux,

thanks for your update.

I’m sorry I can’t reproduce the issue. I experienced it only once but the exception seemed so obvious to me that I decided to report the issue.

I haven’t tried to reproduce it in fixed application.

Regards,
Jan