Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325434 - [rulers] ArrayIndexOutOfBoundsException in LineNumberRulerColumn.paintLine
Summary: [rulers] ArrayIndexOutOfBoundsException in LineNumberRulerColumn.paintLine
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux-GTK
: P5 normal (vote)
Target Milestone: 4.7 M6   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 468725 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-16 06:28 EDT by Andrey Loskutov CLA
Modified: 2017-02-02 16:08 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Loskutov CLA 2010-09-16 06:28:31 EDT
eclipse.buildId=I20100608-0911
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -showLocation
Command-line arguments:  -os linux -ws gtk -arch x86_64 -showLocation

On the Ubuntu 10.04 I see sometimes black regions on the screen, followed by the exceptions like this:

org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.ArrayIndexOutOfBoundsException: 3)
at org.eclipse.swt.SWT.error(SWT.java:4083)
at org.eclipse.swt.SWT.error(SWT.java:3998)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3527)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3174)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at org.eclipse.jface.text.source.LineNumberRulerColumn.paintLine(LineNumberRulerColumn.java:819)
at org.eclipse.jface.text.source.LineNumberRulerColumn.doPaint(LineNumberRulerColumn.java:754)
at org.eclipse.jface.text.source.LineNumberChangeRulerColumn.doPaint(LineNumberChangeRulerColumn.java:194)
at org.eclipse.jface.text.source.LineNumberRulerColumn.doubleBufferPaint(LineNumberRulerColumn.java:703)
at org.eclipse.jface.text.source.LineNumberRulerColumn.redraw(LineNumberRulerColumn.java:859)
at org.eclipse.jface.internal.text.source.DiffPainter.redraw(DiffPainter.java:382)
at org.eclipse.jface.internal.text.source.DiffPainter.access$2(DiffPainter.java:381)
at org.eclipse.jface.internal.text.source.DiffPainter$2.run(DiffPainter.java:371)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
... 23 more

I don't know how to reproduce it, but this occurs often while editing Java source code.
Comment 1 Remy Suen CLA 2010-09-16 07:18:33 EDT
I think I've seen these black rectangles too but don't recall seeing any errors in my log.
Comment 2 Felipe Heidrich CLA 2010-09-16 11:05:39 EDT
the problem happened in JFace Text:
org.eclipse.jface.text.source.LineNumberRulerColumn.paintLine(LineNumberRulerColumn.java:819)
Comment 3 Felipe Heidrich CLA 2010-09-16 11:07:55 EDT
The black rectangle is an unrelated problem (assuming you are running a newer
version of Linux). It is caused when scrolling the editor (likely with the
mouse wheel) when it is covered by a dialog or popup, like the content assist.
Comment 4 Dani Megert CLA 2010-09-16 11:12:11 EDT
>The black rectangle is an unrelated problem (assuming you are running a newer
>version of Linux). It is caused when scrolling the editor 
Is there a bug for that?

Andrei, in which editor do you see the exception? Can you reproduce?
Comment 5 Andrey Loskutov CLA 2010-09-16 11:21:22 EDT
(In reply to comment #4)
> >The black rectangle is an unrelated problem (assuming you are running a newer
> >version of Linux). 

Yes, I use Ubuntu 10.04:

andrei@pinguin ~ $ dpkg -s libgtk2.0-0|grep '^Version'
Version: 2.20.1-0ubuntu2

> It is caused when scrolling the editor 
> Is there a bug for that?

Would be great to have it fixed too, it is soo ugly. I assumed that the log entries was related to this black screen parts.

> Andrei, in which editor do you see the exception? Can you reproduce?

I can't. I saw per occasion the error log today and assumed that this is related to the "black box" issue which occurs at least once per day. There was two identical entries. I mostly work with Java editor, or sometime default text editor, nothing special here.
Comment 6 Andrey Loskutov CLA 2010-09-16 11:53:27 EDT
(In reply to comment #4)
> >The black rectangle is an unrelated problem (assuming you are running a newer
> >version of Linux). It is caused when scrolling the editor 
> Is there a bug for that?

I did not found any, so I've created new one: bug 325485
Comment 7 Dani Megert CLA 2015-05-29 02:29:45 EDT
*** Bug 468725 has been marked as a duplicate of this bug. ***
Comment 8 Andrey Loskutov CLA 2017-02-02 03:00:49 EST
Happened once on latest 4.7 I build while debugging: debugger tried to open java editor and the error was logged:

java.lang.ArrayIndexOutOfBoundsException: 3
	at org.eclipse.jface.text.source.LineNumberRulerColumn.paintLine(LineNumberRulerColumn.java:844)
	at org.eclipse.jface.text.source.LineNumberRulerColumn.doPaint(LineNumberRulerColumn.java:762)
	at org.eclipse.jface.text.source.LineNumberChangeRulerColumn.doPaint(LineNumberChangeRulerColumn.java:176)
	at org.eclipse.jface.text.source.LineNumberRulerColumn.doubleBufferPaint(LineNumberRulerColumn.java:706)
	at org.eclipse.jface.text.source.LineNumberRulerColumn.access$10(LineNumberRulerColumn.java:676)
	at org.eclipse.jface.text.source.LineNumberRulerColumn$4.paintControl(LineNumberRulerColumn.java:618)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:231)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5223)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1374)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1357)
	at org.eclipse.swt.widgets.Control.gtk_draw(Control.java:3361)
	at org.eclipse.swt.widgets.Composite.gtk_draw(Composite.java:344)
	at org.eclipse.swt.widgets.Canvas.gtk_draw(Canvas.java:172)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1938)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5808)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5483)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:8927)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1250)
	at org.eclipse.swt.internal.gtk.OS._gdk_window_process_updates(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_window_process_updates(OS.java:5583)
	at org.eclipse.swt.widgets.Control.update(Control.java:5748)
	at org.eclipse.swt.widgets.Control.update(Control.java:5734)
	at org.eclipse.jface.text.source.OverviewRuler.redraw(OverviewRuler.java:921)
	at org.eclipse.jface.text.source.OverviewRuler.access$2(OverviewRuler.java:914)
	at org.eclipse.jface.text.source.OverviewRuler$InternalListener.textChanged(OverviewRuler.java:87)
	at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2699)
	at org.eclipse.jface.text.TextViewer.invalidateTextPresentation(TextViewer.java:3320)
	at org.eclipse.jface.text.TextViewer.initializeWidgetContents(TextViewer.java:3368)
	at org.eclipse.jface.text.TextViewer.setVisibleDocument(TextViewer.java:3407)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.setVisibleDocument(ProjectionViewer.java:697)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.setVisibleDocument(JavaSourceViewer.java:692)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.executeReplaceVisibleDocument(ProjectionViewer.java:752)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.replaceVisibleDocument(ProjectionViewer.java:740)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.reinitializeProjection(ProjectionViewer.java:1214)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.catchupWithProjectionAnnotationModel(ProjectionViewer.java:935)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.processCatchupRequest(ProjectionViewer.java:852)
	at org.eclipse.jface.text.source.projection.ProjectionViewer$AnnotationModelListener.processModelChanged(ProjectionViewer.java:119)
	at org.eclipse.jface.text.source.projection.ProjectionViewer$AnnotationModelListener.modelChanged(ProjectionViewer.java:111)
	at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:589)
	at org.eclipse.jface.text.source.AnnotationModel$InternalModelListener.modelChanged(AnnotationModel.java:252)
	at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:589)
	at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:555)
	at org.eclipse.jface.text.source.projection.ProjectionAnnotationModel.modifyAnnotations(ProjectionAnnotationModel.java:184)
	at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.update(DefaultJavaFoldingStructureProvider.java:965)
	at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.initialize(DefaultJavaFoldingStructureProvider.java:842)
	at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider.handleProjectionEnabled(DefaultJavaFoldingStructureProvider.java:812)
	at org.eclipse.jdt.ui.text.folding.DefaultJavaFoldingStructureProvider$ProjectionListener.projectionEnabled(DefaultJavaFoldingStructureProvider.java:690)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.fireProjectionEnabled(ProjectionViewer.java:472)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.enableProjection(ProjectionViewer.java:520)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.setVisibleDocument(JavaSourceViewer.java:685)
	at org.eclipse.jface.text.TextViewer.setDocument(TextViewer.java:2795)
	at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:634)
	at org.eclipse.jface.text.source.projection.ProjectionViewer.setDocument(ProjectionViewer.java:365)
	at org.eclipse.jface.text.source.SourceViewer.setDocument(SourceViewer.java:584)
	at org.eclipse.ui.texteditor.AbstractTextEditor.initializeSourceViewer(AbstractTextEditor.java:3995)
	at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput(AbstractTextEditor.java:4183)
	at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput(StatusTextEditor.java:229)
	at org.eclipse.ui.texteditor.AbstractDecoratedTextEditor.doSetInput(AbstractDecoratedTextEditor.java:1466)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.internalDoSetInput(JavaEditor.java:2557)
	at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput(JavaEditor.java:2544)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput(CompilationUnitEditor.java:1417)
	at org.eclipse.ui.texteditor.AbstractTextEditor.setInputWithNotify(AbstractTextEditor.java:4239)
	at org.eclipse.ui.texteditor.AbstractTextEditor.setInput(AbstractTextEditor.java:4259)
	at org.eclipse.ui.internal.WorkbenchPage.reuseEditor(WorkbenchPage.java:3088)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.openEditor(SourceLookupFacility.java:485)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.display(SourceLookupFacility.java:422)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility$SourceDisplayJob.runInUIThread(SourceLookupFacility.java:793)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:95)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4468)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4081)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1133)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:684)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:138)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Comment 9 Andrey Loskutov CLA 2017-02-02 03:14:43 EST
The problem in my last stack seem to appear if the editor is reused and during the input change (ITextListener.textChanged()), multiple rulers are trying to re-display themselves. The problem here is that the overview ruler reacts on the event and triggers a repaint *before* the LineNumberRulerColumn can re-calculate the number of lines (fCachedNumberOfDigits, used to define the size of fIndentation array) via textChanged->updateNumberOfDigits->computeIndentations().
Since the fIndentation array has now "unexpected" size, which do not match real number of document lines, paintLine fails with AIOOBE.

I'm not sure which way we can fix it, because we definitely shouldn't paint if our internal state does not match the document, but we also shouldn't just start re-calculation of the state on every paint request.
Comment 10 Eclipse Genie CLA 2017-02-02 03:59:16 EST
New Gerrit change created: https://git.eclipse.org/r/90154