eclipse-viatra / org.eclipse.viatra

Main components of the VIATRA framework
https://eclipse.dev/viatra
Eclipse Public License 2.0
0 stars 1 forks source link

ConcurrentModificationException when unloading & reloading queries into Query Results View #83

Open eclipse-viatra-bot opened 4 months ago

eclipse-viatra-bot commented 4 months ago

| --- | --- | | Bugzilla Link | 535270 | | Status | NEW | | Importance | P3 normal | | Reported | May 29, 2018 07:46 EDT | | Modified | Nov 23, 2020 08:30 EDT | | Version | 2.0.0 | | See also | Gerrit change https://git.eclipse.org/r/123720, Git commit 76f48798 | | Reporter | Gabor Bergmann |

Description

When using the "Remove loaded queries" button on the Query Results View to unload and then reload queries from an open vql editor, the following exception is thrown:

!ENTRY org.eclipse.core.jobs 4 2 2018-05-29 13:35:19.763\ !MESSAGE An internal error occurred during: "Loading queries into the Query Result View".\ !STACK 0\ java.util.ConcurrentModificationException\ at java.util.HashMap$HashIterator.nextNode(HashMap.java:1437)\ at java.util.HashMap$KeyIterator.next(HashMap.java:1461)\ at com.google.common.collect.AbstractMapBasedMultimap$WrappedCollection$WrappedIterator.next(AbstractMapBasedMultimap.java:486)\ at org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.forgetSpecificationTransitively(SpecificationBuilder.java:357)\ at org.eclipse.viatra.query.patternlanguage.emf.specification.SpecificationBuilder.forgetSpecificationTransitively(SpecificationBuilder.java:373)\ at org.eclipse.viatra.query.tooling.ui.queryresult.QueryResultTreeInput.removeMatcher(QueryResultTreeInput.java:295)\ at org.eclipse.viatra.query.tooling.ui.queryresult.QueryResultTreeInput.removeMatcher(QueryResultTreeInput.java:276)\ at org.eclipse.viatra.query.tooling.ui.queryresult.QueryResultTreeInput.loadQueries(QueryResultTreeInput.java:317)\ at org.eclipse.viatra.query.tooling.ui.queryresult.QueryResultView$1.run(QueryResultView.java:145)\ at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

Likely cause: forgetSpecificationTransitively() recursively calls itself within an iteration over dependantQueries, but modifies said collection at the end of each nested call.

eclipse-viatra-bot commented 4 months ago

May 31, 2018 05:32

New Gerrit change created: https://git.eclipse.org/r/123720

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on May 31, 2018 05:46

I have tried to either reproduce or find the issue by code review, but was not too lucky. I also think that the case for the ConcurrentModification is not so simple as you suggest, as the method changes the dependantQueries, but iterates over sets contained in dependantQueries. Furthermore, after a specification is loaded, the stored set is immutable. To test this, I have added tests this functionality in the related change, and it has worked correctly.

The only way I can imagine the issue you have seen happening is when the SpecificationBuilder adds and removes queries in parallel. However, that should not be possible even though the patterns are loaded by a background thread for the following reason:

eclipse-viatra-bot commented 4 months ago

May 31, 2018 10:02

Gerrit change https://git.eclipse.org/r/123720 was merged to [master].\ Commit: http://git.eclipse.org/c/viatra/org.eclipse.viatra.git/commit/?id=76f48798dd3e058dea7daec090dc1fe8818d5d4b

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on Jun 04, 2018 10:40

We had a long session with Gábor Bergmann today and we could not reproduce the original issue anymore. Given the original issue is not easy to trigger, but any potential fix might break other, more common use cases, I suggest postponing the fix to 2.1 (and possibly backporting it to a 2.0.x bugfix build).

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on Nov 20, 2019 05:51

Postponing issues to the next release.

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on May 18, 2020 13:04

Postponing issues that will not be solved for version 2.5.

eclipse-viatra-bot commented 4 months ago

By Zoltan Ujhelyi on Nov 23, 2020 08:30

Mass postponing of issues to the 2.6 timeframe.