ArrayIndexOutOfBoundsException in ElementContentProvider
Closed this issue · 3 comments
pressed launch button quickly multiple times.
eclipse.buildId=4.23.0.I20220308-0310
java.version=17.0.3
java.vendor=Eclipse Adoptium
java.lang.ArrayIndexOutOfBoundsException: arraycopy: source index -1 out of bounds for object array[8]
at java.base/java.lang.System.arraycopy(Native Method)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.getElements(ElementContentProvider.java:197)
at org.eclipse.debug.internal.ui.model.elements.LaunchManagerContentProvider.getChildren(LaunchManagerContentProvider.java:39)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.retrieveChildren(ElementContentProvider.java:99)
at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$1.run(ElementContentProvider.java:58)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
I tried Launching multiple times from Launch Configuration view, but could not reproduce on the latest IDE.
Possibly we can safeguard with checks on index and length.
well, i can reproduce it - when i launch Thread.sleep(1000) in the debug perspective 3 times a second i get a hit after <100 tries.
org.eclipse.debug.internal.ui.viewers.model.FilterTransform.Node.viewToModel(int) can return -1.
Then org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateElement(TreePath, int) creates an update element with illegal index.
That happens especially when viewIndex=-1
and that happens when Event.index=-1
and this does happen on windows if org.eclipse.swt.widgets.Tree.indexOf(TreeItem) returns -1
with this stack:
Thread [main] (Suspended (breakpoint at line 1079 in Widget))
owns: RunnableLock (id=4861)
Tree(Widget).sendEvent(int, Event, boolean) line: 1079
Tree(Widget).sendEvent(int, Event) line: 1075
Tree.checkData(TreeItem, int, boolean) line: 1646
Tree.checkData(TreeItem, boolean) line: 1625
Tree.wmNotifyChild(NMHDR, long, long) line: 7406
PageBook(Control).wmNotify(NMHDR, long, long) line: 5800
PageBook(Composite).wmNotify(NMHDR, long, long) line: 1961
PageBook(Control).WM_NOTIFY(long, long) line: 5368
PageBook(Control).windowProc(long, int, long, long) line: 4802
Display.windowProc(long, long, long, long) line: 5026
OS.CallWindowProc(long, long, int, long, long) line: not available [native method]
Tree.callWindowProc(long, int, long, long) line: 1542
Tree(Control).windowProc(long, int, long, long) line: 4847
Tree.windowProc(long, int, long, long) line: 6059
Display.windowProc(long, long, long, long) line: 5026
OS.SendMessage(long, int, long, TVINSERTSTRUCT) line: not available [native method]
Tree.createItem(TreeItem, long, long, long) line: 2094
Tree.setItemCount(int, long) line: 4239
Tree.setItemCount(int) line: 4151
TreeModelViewer(TreeViewer).lambda$2(Object, int) line: 388
0x00000008014cc610.run() line: not available
TreeModelViewer(StructuredViewer).preservingSelection(Runnable, boolean) line: 1398
TreeModelViewer(TreeViewer).preservingSelection(Runnable, boolean) line: 365
TreeModelViewer(StructuredViewer).preservingSelection(Runnable) line: 1359
TreeModelViewer(TreeViewer).setChildCount(Object, int) line: 386
TreeModelContentProvider.handleExpand(IModelDelta) line: 1405
TreeModelContentProvider.handleExpand(IModelDelta) line: 1394
TreeModelContentProvider.updateNodes(IModelDelta[], int) line: 1300
TreeModelContentProvider.updateNodes(IModelDelta[], int) line: 1312
TreeModelContentProvider.updateModel(IModelDelta, int) line: 578
TreeModelContentProvider.doModelChanged(IModelDelta, IModelProxy) line: 543
TreeModelContentProvider$DelayedDoModelChangedJob.runInUIThread(IProgressMonitor) line: 449
TreeModelContentProvider$DelayedDoModelChangedJob(UIJob).lambda$0(IProgressMonitor) line: 95
0x000000080127c880.run() line: not available
RunnableLock.run(Display) line: 40
UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 132
Display.runAsyncMessages(boolean) line: 4043
Display.readAndDispatch() line: 3648
PartRenderingEngine$5.run() line: 1155
Realm.runWithDefault(Realm, Runnable) line: 338
PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 1046
E4Workbench.createAndRunUI(MApplicationElement) line: 155
Workbench.lambda$3(Display, WorkbenchAdvisor, int[]) line: 644
0x0000000800dd7dd8.run() line: not available
Realm.runWithDefault(Realm, Runnable) line: 338
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 551
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 156
IDEApplication.start(IApplicationContext) line: 152
EclipseAppHandle.run(Object) line: 203
EclipseAppLauncher.runApplication(Object) line: 136
EclipseAppLauncher.start(Object) line: 104
EclipseStarter.run(Object) line: 402
EclipseStarter.run(String[], Runnable) line: 255
DirectMethodHandle$Holder.invokeStatic(Object, Object, Object) line: not available
0x0000000800c07800.invoke(Object, Object, Object, Object) line: not available
0x0000000800c07c00.invokeExact_MT(Object, Object, Object, Object, Object) line: not available
DirectMethodHandleAccessor.invokeImpl(Object, Object[]) line: 156
DirectMethodHandleAccessor.invoke(Object, Object[]) line: 104
Method.invoke(Object, Object...) line: 577
Main.invokeFramework(String[], URL[]) line: 659
Main.basicRun(String[]) line: 596
Main.run(String[]) line: 1467
Main.main(String[]) line: 1440
So the question is WHERE the check should be done. Maybe in TreeModelContentProvider.updateElement(TreePath, int)?
or in SWT - if event.index <0 never sendEvent() in org.eclipse.swt.widgets.Tree.checkData(TreeItem, int, boolean)?
I don't know.
Can not reproduce anymore. may be solved with eclipse-platform/eclipse.platform.swt#333