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

A lot of UI freezes caused by DocumentLinkDetector.detectHyperlinks #698

Closed
sebthom opened this issue Jun 20, 2023 · 11 comments
Closed

A lot of UI freezes caused by DocumentLinkDetector.detectHyperlinks #698

sebthom opened this issue Jun 20, 2023 · 11 comments

Comments

@sebthom
Copy link
Member

sebthom commented Jun 20, 2023

I upgraded to Eclipse 2023-06 and it is barely usable for me to do Java coding. I am experiencing constant UI freezes when doing operations like:

  • cutting/copying source code to the clipboard CTRL+X/CTRL+C
  • pasting source code from the clipboard CTRL+V
  • opening the quick type hierarchy using CTRL+T
  • copying text from the Java Stack Trace Console

When the UI freezes occur I always see the same stacktrace in a thread dump:

"main" #1 prio=6 os_prio=0 cpu=987406.25ms elapsed=29548.05s tid=0x000001ef7c490270 nid=0x2928 waiting on condition  [0x00000061d2ffd000]
   java.lang.Thread.State: TIMED_WAITING (parking)
        at jdk.internal.misc.Unsafe.park(java.base@17.0.7/Native Method)
        - parking to wait for  <0x0000000787f61660> (a java.util.concurrent.CompletableFuture$Signaller)
        at java.util.concurrent.locks.LockSupport.parkNanos(java.base@17.0.7/LockSupport.java:252)
        at java.util.concurrent.CompletableFuture$Signaller.block(java.base@17.0.7/CompletableFuture.java:1866)
        at java.util.concurrent.ForkJoinPool.unmanagedBlock(java.base@17.0.7/ForkJoinPool.java:3463)
        at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17.0.7/ForkJoinPool.java:3434)
        at java.util.concurrent.CompletableFuture.timedGet(java.base@17.0.7/CompletableFuture.java:1939)
        at java.util.concurrent.CompletableFuture.get(java.base@17.0.7/CompletableFuture.java:2095)
        at org.eclipse.lsp4e.operations.documentLink.DocumentLinkDetector.detectHyperlinks(DocumentLinkDetector.java:95)
        at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:81)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
        - locked <0x000000073d8002c0> (a [Lorg.eclipse.jface.text.hyperlink.IHyperlinkDetector;)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:262)
        at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:457)
        at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:216)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4274)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3660)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
        at org.eclipse.ui.internal.Workbench$$Lambda$239/0x00000007c02d6030.run(Unknown Source)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@17.0.7/Native Method)
        at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@17.0.7/NativeMethodAccessorImpl.java:77)
        at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@17.0.7/DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(java.base@17.0.7/Method.java:568)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1467)

   Locked ownable synchronizers:
        - None

threaddump.txt

image

Any help is greatly appreciated.

@sebthom
Copy link
Member Author

sebthom commented Jun 20, 2023

Since DocumentLinkDetector is executed on the UI thread I don't think it should block for up to four seconds, no matter what the reason is:

@jonahgraham
Copy link
Contributor

I see this same issue in CDT LSP - see eclipse-cdt/cdt-lsp#138

The 4 seconds here came from combining 2 different gets of 2 seconds each when the code was refactored. I also see 800 ms timeouts (and corresponding freezes):

@sebthom
Copy link
Member Author

sebthom commented Jun 20, 2023

I also wonder why/what takes 4 seconds. It does not matter how large the source file is I am editing. It also freezes for very small Java classes.

@jonahgraham
Copy link
Contributor

Do you have the LSP4E trace - I see this in the log:

I[12:44:38.080] --> reply:textDocument/documentLink("7") 6470 ms

and numerous other ones with many seconds to reply. These are all happening in CDT LSP case when the language server is genuinely very slow to respond.

@sebthom
Copy link
Member Author

sebthom commented Jun 20, 2023

How can I enable the trace? I downloaded the pre-built Eclipse distribution.

@jonahgraham
Copy link
Contributor

How can I enable the trace? I downloaded the pre-built Eclipse distribution.

I ran eclipse with -consoleLog and it just worked - but I don't know if CDT LSP added something the shows those traces. Maybe @ghentschke knows the answer.

@ghentschke
Copy link
Contributor

ghentschke commented Jun 21, 2023

if CDT LSP added something the shows those traces

No, we haven't

@ghentschke
Copy link
Contributor

ghentschke commented Jul 3, 2023

@sebthom: are there any new info on this issue?

For C/C++ projects it depends on the amount of files in a project. Not very much on the size of the opened file.

@sebthom
Copy link
Member Author

sebthom commented Jul 3, 2023

For some reasons the issue disappeared on my machine for now.

@angelozerr
Copy link
Contributor

angelozerr commented Aug 9, 2023

When I see your threaddump, I have seen:

"ForkJoinPool.commonPool-worker-80" #5782 daemon prio=5 os_prio=0 cpu=234.38ms elapsed=6748.25s tid=0x000001ef32af7020 nid=0x7630 waiting on condition  [0x00000061d9cfe000]
   java.lang.Thread.State: WAITING (parking)
        at jdk.internal.misc.Unsafe.park(java.base@17.0.7/Native Method)
        - parking to wait for  <0x000000073d8ad2a8> (a java.util.concurrent.CompletableFuture$Signaller)
        at java.util.concurrent.locks.LockSupport.park(java.base@17.0.7/LockSupport.java:211)
        at java.util.concurrent.CompletableFuture$Signaller.block(java.base@17.0.7/CompletableFuture.java:1864)
        at java.util.concurrent.ForkJoinPool.compensatedBlock(java.base@17.0.7/ForkJoinPool.java:3449)
        at java.util.concurrent.ForkJoinPool.managedBlock(java.base@17.0.7/ForkJoinPool.java:3432)
        at java.util.concurrent.CompletableFuture.waitingGet(java.base@17.0.7/CompletableFuture.java:1898)
        at java.util.concurrent.CompletableFuture.get(java.base@17.0.7/CompletableFuture.java:2072)
        at org.eclipse.lsp4e.operations.completion.LSContentAssistProcessor.computeCompletionProposals(LSContentAssistProcessor.java:114)
        at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$10(AsyncCompletionProposalPopup.java:378)
        at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup$$Lambda$4370/0x00000007c291a8a8.run(Unknown Source)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
        at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup.lambda$9(AsyncCompletionProposalPopup.java:377)
        at org.eclipse.jface.text.contentassist.AsyncCompletionProposalPopup$$Lambda$4368/0x00000007c291a448.get(Unknown Source)
        at java.util.concurrent.CompletableFuture$AsyncSupply.run(java.base@17.0.7/CompletableFuture.java:1768)
        at java.util.concurrent.CompletableFuture$AsyncSupply.exec(java.base@17.0.7/CompletableFuture.java:1760)
        at java.util.concurrent.ForkJoinTask.doExec(java.base@17.0.7/ForkJoinTask.java:373)
        at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base@17.0.7/ForkJoinPool.java:1182)
        at java.util.concurrent.ForkJoinPool.scan(java.base@17.0.7/ForkJoinPool.java:1655)
        at java.util.concurrent.ForkJoinPool.runWorker(java.base@17.0.7/ForkJoinPool.java:1622)
        at java.util.concurrent.ForkJoinWorkerThread.run(java.base@17.0.7/ForkJoinWorkerThread.java:165)

Which is waiting for infinite time here

And as the future is never canceled, I suspect it is the same issue than #743 (comment)

I did a PR to cancel this future #750

@vogella
Copy link

vogella commented Nov 1, 2023

Can this issue be clone in this case @sebthom?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants