Skip to content

BadLocationException when a large amount of content is logged to the Eclipse Console #3560

@ethanyhou

Description

@ethanyhou

Hi, we are developing a plugin that communicates with the LSP. For debugging purposes, we need to enable Language Server logs via “Log to Console.” We have observed that numerous exceptions occur when the logged content becomes large, which also causes the Eclipse workbench to freeze:

org.eclipse.jface.text.BadLocationException: 338
	at org.eclipse.jface.text.TreeLineTracker.offsetByLine(TreeLineTracker.java:335)
	at org.eclipse.jface.text.TreeLineTracker.getLineOffset(TreeLineTracker.java:1101)
	at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:252)
	at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:868)
	at org.eclipse.ui.internal.console.ConsoleDocument.getLineOffset(ConsoleDocument.java:59)
	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getLineOffset(ConsoleDocumentAdapter.java:354)
	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.getOffsetAtLine(ConsoleDocumentAdapter.java:332)
	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1099)
	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:984)
	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:306)
	at org.eclipse.swt.custom.StyledText.getVerticalScrollOffset(StyledText.java:5066)
	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4224)
	at org.eclipse.swt.custom.StyledText.getOffsetAtPoint(StyledText.java:4176)
	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8522)
	at org.eclipse.swt.custom.StyledText.setCaretLocations(StyledText.java:8479)
	at org.eclipse.swt.custom.StyledText.updateSelection(StyledText.java:10865)
	at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:6120)
	at org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5442)
	at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentChanged(ConsoleDocumentAdapter.java:588)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:739)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:708)
	at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:692)
	at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:766)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1091)
	at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1109)
	at org.eclipse.ui.internal.console.ConsoleDocument.replace(ConsoleDocument.java:74)
	at org.eclipse.ui.internal.console.IOConsolePartitioner.trim(IOConsolePartitioner.java:1216)
	at org.eclipse.ui.internal.console.IOConsolePartitioner.checkBufferSize(IOConsolePartitioner.java:438)
	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.processPendingPartitions(IOConsolePartitioner.java:808)
	at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:763)
	at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:148)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4135)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3751)
	at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
	at org.eclipse.jface.window.Window.open(Window.java:799)
	at com.microsoft.copilot.eclipse.ui.chat.TopBanner$1.widgetSelected(TopBanner.java:99)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:286)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1214)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4160)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3748)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:627)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1431)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1403)

Can anyone help with this issue? Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions