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

Both Eclipse 2022-06 and 2022-12 often hanging forever on startup #539

Closed
davidmichaelkarr opened this issue Jan 26, 2023 · 14 comments
Closed
Assignees
Labels
Windows Happens on Windows OS

Comments

@davidmichaelkarr
Copy link

For the last few weeks, I've been struggling with Eclipse 2022-12 consistently hanging forever on startup, and 2022-06 often doing the same thing, but seemingly not as often. Yesterday afternoon, I started 2022-12 and it got into the hung state, so I left it alone until later in the evening, and it was still hung. I took a threaddump at that point, killed the process, and then started 2022-06. It appeared to hang also. I left it alone until this morning, and it was still hung. I took a threaddump at that point and killed the process. I'm getting to the point where I can't get anything done with this.
threaddump.202206.txt
threaddump.202212.txt

@jonahgraham
Copy link
Contributor

This is an SWT problem. I am going to transfer issue there.

@jonahgraham jonahgraham transferred this issue from eclipse-platform/eclipse.platform.debug Jan 26, 2023
@jonahgraham
Copy link
Contributor

@davidmichaelkarr it looks like Eclipse is hanging in the Windows native code that calculates exactly how to layout text.

As far as I can tell the issue is in a console view. Can you provide any insights about which console views may be involved so I can try to reproduce this?


"main" #1 prio=6 os_prio=0 cpu=16956234.38ms elapsed=30861.56s tid=0x00000148ee5f1a20 nid=30224 runnable  [0x0000003a16b1d000]
   java.lang.Thread.State: RUNNABLE
        at org.eclipse.swt.internal.win32.OS.ScriptPlace(Native Method)
        at org.eclipse.swt.graphics.TextLayout.shape(TextLayout.java:3760)
        at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:405)
        at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:1657)
        at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:299)

@jonahgraham
Copy link
Contributor

If possible, can you take a few stack dumps back to back? I don't think you need to leave it overnight, a few minutes of a hang is sufficient.

Other useful information is which version of Windows are you using?

@jonahgraham jonahgraham self-assigned this Jan 26, 2023
@davidmichaelkarr
Copy link
Author

Microsoft Windows 11 Enterprise, Version 10.0.22000 (Service Pack: 0.0)

This is 2022-06. I believe I have the lsp console enabled in this version. I use Maven, so occasionally the Maven console is running. I often run springboot applications, and I have a console for that. I'm not sure what others would be there. Is it possible to determine the available consoles from the file system? I can't very well determine what's there right now.

threaddump.202206.5.txt
threaddump.202206.4.txt
threaddump.202206.3.txt
threaddump.202206.2.txt
threaddump.202206.1.txt
threaddump.202206.7.txt
threaddump.202206.6.txt

@iloveeclipse iloveeclipse added the Windows Happens on Windows OS label Jan 26, 2023
@jonahgraham
Copy link
Contributor

Thanks, those extra traces are very useful.

The highest common function on all those stack traces is org.eclipse.swt.graphics.TextLayout.computeRuns (different line numbers each time)

full common trace
        at org.eclipse.swt.graphics.TextLayout.computeRuns(TextLayout.java:405)
        at org.eclipse.swt.graphics.TextLayout.getBounds(TextLayout.java:1657)
        at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:299)
        at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:682)
        at org.eclipse.swt.custom.StyledTextRenderer.getLineHeight(StyledTextRenderer.java:673)
        at org.eclipse.swt.custom.StyledText.getLinePixel(StyledText.java:4389)
        at org.eclipse.swt.custom.StyledText.handleTextChanged(StyledText.java:6569)
        at org.eclipse.swt.custom.StyledText$5.textChanged(StyledText.java:5912)
        at org.eclipse.ui.internal.console.ConsoleDocumentAdapter.documentChanged(ConsoleDocumentAdapter.java:588)
        - locked <0x000000008767ac70> (a org.eclipse.ui.internal.console.ConsoleDocumentAdapter)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged2(AbstractDocument.java:748)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:717)
        at org.eclipse.jface.text.AbstractDocument.doFireDocumentChanged(AbstractDocument.java:701)
        at org.eclipse.jface.text.AbstractDocument.fireDocumentChanged(AbstractDocument.java:775)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1100)
        at org.eclipse.jface.text.AbstractDocument.replace(AbstractDocument.java:1118)
        at org.eclipse.ui.internal.console.ConsoleDocument.replace(ConsoleDocument.java:74)
        - locked <0x000000008767ad18> (a org.eclipse.ui.internal.console.ConsoleDocument)
        at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.applyOutputToDocument(IOConsolePartitioner.java:1140)
        at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.applyStreamOutput(IOConsolePartitioner.java:963)
        at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.processPendingPartitions(IOConsolePartitioner.java:800)
        - locked <0x000000008767adf8> (a java.util.ArrayList)
        at org.eclipse.ui.internal.console.IOConsolePartitioner$QueueProcessingJob.runInUIThread(IOConsolePartitioner.java:758)
        at org.eclipse.ui.progress.UIJob.lambda$0(UIJob.java:95)
        at org.eclipse.ui.progress.UIJob$$Lambda$1047/0x00000008017ef618.run(Unknown Source)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)

computeRuns is mostly unchanged in years and years, but some other code has changed in that area recently, both in 2022-03 and 2022-06 timeframe.

I added support for rendering longer lines (Bug 579335 and Bug 23406) and @niraj-modi fixed bug 579626. I can't see how @niraj-modi's change could cause infinite loop, but I can believe that my changes did.

The other significant change was adding ANSI support in 2022-06 to the console. That is relevant only as that may be providing some new input data to the styled text that wasn't there in 2022-03, exposing a bug in TextLayout.

@jonahgraham
Copy link
Contributor

@davidmichaelkarr To try to narrow this down I want to eliminate the ANSI support in the console as a possible cause.

Can you add this file to the workspace and then start Eclipse again. If it starts successfully, grab the contents of all the open consoles and attach them here so I can reproduce the problem.

file: .metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.console.prefs
contents:

ANSI_support_enabled=false
eclipse.preferences.version=1

If you already have that file, please just add:

ANSI_support_enabled=false

to the file. If ANSI_support_enabled is already listed as true, change the true to false.

@davidmichaelkarr
Copy link
Author

davidmichaelkarr commented Jan 26, 2023

Ok, well, I made the change to that file and restarted, but it's still hanging.
threaddump.202206.afteransichange.txt

Note that I also had this line in that file:
org.eclipse.ui.console.P_CONSOLE_WORD_WRAP=true

@davidmichaelkarr
Copy link
Author

Hmm, after another try, I see that it is not hanging yet. If anything, there is a race condition that results in it not happening all the time. I made the same change in 2022-12 workspace, and I've tried restarting a couple of times now, and it hasn't hung yet. I'm willing to try other variations if it helps you narrow this down.

@jonahgraham
Copy link
Contributor

Do any of the consoles have any text in them? That may help.

image


Note that I also had this line in that file:
org.eclipse.ui.console.P_CONSOLE_WORD_WRAP=true

Work wrapping the console can slow it down so dramatically that it looks hung. But as you left it overnight it seems unlikely that was the sole problem. I recommend turning off work wrap if you have any performance problems in the console.

@davidmichaelkarr
Copy link
Author

Before this point I have never noticed any performance problems in the console, and I set word wrap in the console every time I install Eclipse.

In my running 2022-12 instance, which is currently NOT hung, I have three consoles:

  • org.eclipse.lsp4e
  • Emacs+ Console
  • A SpringBoot application console

The contents of the second one is easy, as it gets the same content every time I start Eclipse:

Kbd Macro convert-setter-to-fluent-setter loaded
Kbd Macro println loaded

The lsp4e console as of right now has 90k lines in it, and I see that some of them are very long lines. I suppose that word wrap might have to do a bit of work there, but note that my Eclipse is currently NOT hung.

As of right now, the spring-boot application console has quite a few lines in it, but again, Eclipse is currently NOT hung, and this console would never have any content at startup. The lsp4e console OFTEN does have content at startup.

@davidmichaelkarr
Copy link
Author

I had another hang of the 2022-12 instance, so I decided to try turning off wordwrap. The next attempt didn't hang. That doesn't mean it fixed the problem, just a data point.

@jonahgraham
Copy link
Contributor

That sounds frustrating and I appreciate your persistence in trying to solve the problem.

90k lines in the console is also quite a lot. You could try limiting the console output if you don't need it all. But similar to word wrap, I can understand some performance degredations and some hangs, but not an overnight amount. That still sounds like something more significant.

Are you able to attach the output from LSP4E console, that seems like the most likely culprit as it is there when you start up? If you are concerned about updating an arbitrary log, you can email it to me jonah at kichwacoders dot com and I can experiment with it and hopefully create a reproducer.

image

@davidmichaelkarr
Copy link
Author

Sorry I haven't responded in a while. I've gone in a slightly different direction, simply disabling the lsp4e console, and also setting a console limit of 200000. I've tried restarts several times since I did that, and I haven't seen a deadlock yet.

@jonahgraham
Copy link
Contributor

Thank you David for reporting back. While I obviously want to reproduce the problem, for now I am delighted to hear that we seem to have a solution that allows you to proceed.

I am going to close this issue now as there isn't anything actionable anymore. Happy to reopen it if more details come up.

In addition, I have started a discussion on eclipse/lsp4e#419 to spread the word about the hangs you have seen to see if other LSP4E users or devs have run across this.

@jonahgraham jonahgraham closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Windows Happens on Windows OS
Projects
None yet
Development

No branches or pull requests

3 participants