Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 318036

Summary: When open a large text file (file size > 1m or more) in the text editor, change the encoding to UTF-16. the whole Eclipse IDE UI hangs forever
Product: [Eclipse Project] Platform Reporter: Missing name <bingfangsong>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: critical    
Priority: P3 CC: daniel_megert, darin.eclipse, eclipse.felipe, remy.suen
Version: 3.5.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Missing name CLA 2010-06-25 15:10:31 EDT
Build Identifier: Build id: 20090920-1017

In our appication, we support UTF-16 encoding for large file open the Text editor. If user open a large file say bigger than 1.7M, after change the encoding to UTF-16, the UI hangs forever.

 

Reproducible: Always

Steps to Reproduce:
1.Import a large text file into workspace. The file size > 1.5M or more
2.Open the file in the eclipse text editor
3.Go to Edit menu to change the encoding to UTF-16. Now UI hanges forever.
Comment 1 Darin Wright CLA 2010-06-25 15:17:22 EDT
Moving to Platform UI
Comment 2 Remy Suen CLA 2010-06-30 07:52:46 EDT
(In reply to comment #0)
> 3.Go to Edit menu to change the encoding to UTF-16. Now UI hanges forever.

Please get a thread dump.
http://wiki.eclipse.org/index.php/How_to_report_a_deadlock
Comment 3 Prakash Rangaraj CLA 2010-07-29 02:37:15 EDT
Moving to Platform Text
Comment 4 Dani Megert CLA 2010-07-29 02:47:57 EDT
Here's the stack dump (based on N20100728-2000):

"main" prio=6 tid=0x002b7000 nid=0x1270 runnable [0x0090e000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.swt.internal.win32.OS.GetTextMetricsW(Native Method)
        at org.eclipse.swt.internal.win32.OS.GetTextMetrics(OS.java:2753)
        at org.eclipse.swt.graphics.TextLayout.shape(TextLayout.java:3386)
        at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:242)
        at org.eclipse.swt.graphics.TextLayout.getLineCount(TextLayout.java:1798)
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:980)
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:719)
        at org.eclipse.swt.custom.StyledText.getPointAtOffset(StyledText.java:5439)
        at org.eclipse.swt.custom.StyledText.setCaretLocation(StyledText.java:8339)
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:1014)
        at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:719)
        at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:211)
        at org.eclipse.swt.custom.StyledTextRenderer.calculateClientArea(StyledTextRenderer.java:229)
        at org.eclipse.swt.custom.StyledText.resetCache(StyledText.java:7780)
        at org.eclipse.swt.custom.StyledText.reset(StyledText.java:7773)
        at org.eclipse.swt.custom.StyledText.handleTextSet(StyledText.java:6289)
        at org.eclipse.swt.custom.StyledText$6.textSet(StyledText.java:5636)
        at org.eclipse.jface.text.DefaultDocumentAdapter.fireTextSet(DefaultDocumentAdapter.java:364)
        at org.eclipse.jface.text.DefaultDocumentAdapter.documentChanged(DefaultDocumentAdapter.java:287)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:760)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:736)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:721)
        at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:796)
        at org.eclipse.jface.text.AbstractDocument.set(AbstractDocument.java:1237)
        at org.eclipse.core.internal.filebuffers.SynchronizableDocument.set(SynchronizableDocument.java:223)
        - locked <0x0acf0ba8> (a java.lang.Object)
        at org.eclipse.core.internal.filebuffers.ResourceTextFileBuffer.handleFileContentChanged(ResourceTextFileBuffer.java:508)
        at org.eclipse.core.internal.filebuffers.ResourceFileBuffer$1.execute(ResourceFileBuffer.java:142)
        at org.eclipse.core.internal.filebuffers.ResourceFileBuffer$SafeFileChange.run(ResourceFileBuffer.java:86)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        - locked <0x0f0a6428> (a org.eclipse.swt.widgets.RunnableLock)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4041)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
        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)
        at org.eclipse.core.launcher.Main.main(Main.java:34)
Comment 5 Felipe Heidrich CLA 2010-07-29 09:10:35 EDT
Is the content of the file encoded in UTF-16 ?
How many lines does the file have ?
Comment 6 Dani Megert CLA 2010-07-29 09:18:40 EDT
I used a simple text file with 1 MB, no long lines, Cp1252 encoded. Everything fine. Then I switched the encoding and the workbench becomes unusable.
Comment 7 Felipe Heidrich CLA 2010-07-29 09:47:11 EDT
(In reply to comment #6)
> I used a simple text file with 1 MB, no long lines, Cp1252 encoded. Everything
> fine. Then I switched the encoding and the workbench becomes unusable.

Right, my guess is that when you change to utf-16 all the lines delimiters are garbled turning the entire file in one huge line filled with invalid characters.
Comment 8 Eclipse Webmaster CLA 2019-09-06 16:12:49 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 9 Eclipse Genie CLA 2022-02-08 12:36:22 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.