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

ConcurrentModificationException in LaunchBarManager.storeActiveDescriptor() #262

Closed
trancexpress opened this issue Jan 27, 2023 · 1 comment · Fixed by #263
Closed

ConcurrentModificationException in LaunchBarManager.storeActiveDescriptor() #262

trancexpress opened this issue Jan 27, 2023 · 1 comment · Fixed by #263
Labels
debug The debug components of CDT, anything to do with running or debugging the target.
Milestone

Comments

@trancexpress
Copy link
Contributor

Describe the bug
During our ARTs, we encountered the following CME:

java.util.ConcurrentModificationException
	at java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:756)
	at java.base/java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:778)
	at org.eclipse.launchbar.core.internal.LaunchBarManager.storeActiveDescriptor(LaunchBarManager.java:511)
	at org.eclipse.launchbar.core.internal.LaunchBarManager.setActiveLaunchDescriptor(LaunchBarManager.java:487)
	at org.eclipse.launchbar.core.internal.LaunchBarManager.addDescriptor(LaunchBarManager.java:309)
	at org.eclipse.launchbar.core.internal.LaunchBarManager.launchObjectAdded(LaunchBarManager.java:358)
	at org.eclipse.launchbar.core.internal.LaunchBarManager.launchConfigurationAdded(LaunchBarManager.java:899)
	at org.eclipse.debug.internal.core.LaunchManager$ConfigurationNotifier.run(LaunchManager.java:219)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.debug.internal.core.LaunchManager$ConfigurationNotifier.notify(LaunchManager.java:209)
	at org.eclipse.debug.internal.core.LaunchManager.launchConfigurationAdded(LaunchManager.java:2120)
	at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.writeNewFile(LaunchConfigurationWorkingCopy.java:375)
	at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave0(LaunchConfigurationWorkingCopy.java:259)
	at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave(LaunchConfigurationWorkingCopy.java:229)
	at org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy.doSave(LaunchConfigurationWorkingCopy.java:187)
        ...
        at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

The above is triggered from one of our plug-ins, while creating a launch configuration (and saving it).

If I debug the respective test, I see also a job is trying to change the container in question:

"Worker-21: Launching AttachDebug" #206 prio=5 os_prio=0 cpu=51.90ms elapsed=102.18s tid=0x00005555556a9ee0 nid=0x5f8c at breakpoint [0x00007fff74ef9000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.launchbar.core.internal.LaunchBarManager.doSetActiveLaunchDescriptor(LaunchBarManager.java:501)
        at org.eclipse.launchbar.core.internal.LaunchBarManager.setActive(LaunchBarManager.java:443)
        at org.eclipse.launchbar.core.internal.LaunchBarManager$2.launchAdded(LaunchBarManager.java:172)
        at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.run(LaunchManager.java:425)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
        at org.eclipse.debug.internal.core.LaunchManager$LaunchNotifier.notify(LaunchManager.java:415)
        at org.eclipse.debug.internal.core.LaunchManager.fireUpdate(LaunchManager.java:1046)
        at org.eclipse.debug.internal.core.LaunchManager.addLaunch(LaunchManager.java:693)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:764)
        at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:717)
        at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1040)
        at org.eclipse.debug.internal.ui.DebugUIPlugin$1.run(DebugUIPlugin.java:1243)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

I can't reproduce the race conditions itself though.

Expected behavior
No CME occurrs.

trancexpress added a commit to trancexpress/cdt that referenced this issue Jan 27, 2023
This change synchronizes access to LaunchBarManager.descriptors, to
avoid a ConcurrentModificationException when adding descriptors for 2
launches at the same time.

Fixes: eclipse-cdt#262
trancexpress added a commit to trancexpress/cdt that referenced this issue Jan 27, 2023
This change synchronizes access to LaunchBarManager.descriptors, to
avoid a ConcurrentModificationException when adding descriptors for 2
launches at the same time.

Fixes: eclipse-cdt#262
@jonahgraham jonahgraham added the debug The debug components of CDT, anything to do with running or debugging the target. label Jan 30, 2023
@jonahgraham jonahgraham added this to the 11.1.0 milestone Jan 30, 2023
jonahgraham pushed a commit that referenced this issue Feb 4, 2023
This change synchronizes access to LaunchBarManager.descriptors, to
avoid a ConcurrentModificationException when adding descriptors for 2
launches at the same time.

Fixes: #262
@jonahgraham
Copy link
Member

@trancexpress I merged the change now, if you want to cleanup that code further I would be happy to review such changes too.

trancexpress added a commit to trancexpress/cdt that referenced this issue Feb 6, 2023
This change makes LaunchBarManager.descriptors a synchronized map,
slightly reducing the extra code and complexity added for eclipse-cdt#262.

Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
jonahgraham pushed a commit that referenced this issue Feb 6, 2023
This change makes LaunchBarManager.descriptors a synchronized map,
slightly reducing the extra code and complexity added for #262.

Signed-off-by: Simeon Andreev <simeon.danailov.andreev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debug The debug components of CDT, anything to do with running or debugging the target.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants