eclipse-m2e / m2e-core

Eclipse Public License 2.0
113 stars 115 forks source link

TimeoutException thrown when hovering over dependencies #839

Open CarlosMOGoncalves opened 2 years ago

CarlosMOGoncalves commented 2 years ago

Description

On the very first time I open Eclipse and try to hover over a dependency, it throws a java.util.concurrent.TimeoutException. Sometimes it keeps throwing that exception a couple more times until it somehow overcomes it and works normally.

Expected Outcome

Well, by throwing that exception it won't draw the tooltip with the dependency version. So I expect it to work properly, not to throws that exception and as a result load the info tooltip right away.

Current Outcome

When hovering the mouse pointer over a lib dependency it will throw the following exception and not show the info tooltip:

java.util.concurrent.TimeoutException
    at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
    at org.eclipse.lsp4e.operations.hover.LSPTextHover.getHoverRegion(LSPTextHover.java:150)
    at org.eclipse.ui.internal.genericeditor.hover.CompositeTextHover.getHoverRegion(CompositeTextHover.java:101)
    at org.eclipse.jface.text.TextViewerHoverManager.computeInformation(TextViewerHoverManager.java:128)
    at org.eclipse.jface.text.AbstractInformationControlManager.doShowInformation(AbstractInformationControlManager.java:1101)
    at org.eclipse.jface.text.AbstractHoverInformationControlManager$MouseTracker.mouseHover(AbstractHoverInformationControlManager.java:511)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
    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:644)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
    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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(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)

java.util.concurrent.TimeoutException
    at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
    at org.eclipse.lsp4e.operations.hover.LSPTextHover.getHoverInfo(LSPTextHover.java:73)
    at org.eclipse.ui.internal.genericeditor.hover.CompositeTextHover.getHoverInfo2(CompositeTextHover.java:60)
    at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155)

Steps to reproduce

I have a sample project that I use for other issues here. This is a rather simple app with some dependencies. It has 3 branches, one for each LTS of JDK.

  1. Download Eclipse IDE 2022-06 for Enterprise Java and Web Developers Windows x64 here
  2. checkout above project
  3. import it to eclipse
  4. Restart Eclipse
  5. navigate to pom.xml
  6. hover over any dependency, like org.eclipse.microprofile
  7. Exception should be thrown and appear on error log
  8. If not, try restarting Eclipse and hover over it again

M2E_hover

Environment

eliasbalasis commented 2 years ago

I am getting the same behavior on Eclipse 2022-09 , having first noticed on Eclipse 2022-03 and not just on dependencies but Maven properties as well.

It feels like a Language Servers issue and I recall having to turn those off in the past due to various other issues.

However, turning Language Servers off didn't work either on Eclipse 2022-09.

We are stuck with Eclipse 2021-03 because of this, unable to upgrade.

mickaelistria commented 2 years ago

JDK Version: OpenJDK Corretto 1.8.0_322

Java 17 is required to properlu run m2e.

eliasbalasis commented 2 years ago

Thanks @mickaelistria. However, Eclipse 2022-09 is running on Java17

-vm
plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.4.v20220903-1038/jre/bin
ca-stefan-cordes commented 2 years ago

Even with java 17 timeouts appear:

jdk-17.0.4.1-1

image Workaround is to wait some seconds and try again.

One example:

java.util.concurrent.TimeoutException
    at java.base/java.util.concurrent.CompletableFuture.timedGet(CompletableFuture.java:1960)
    at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2095)
    at org.eclipse.lsp4e.operations.declaration.OpenDeclarationHyperlinkDetector.detectHyperlinks(OpenDeclarationHyperlinkDetector.java:94)
    at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:81)
    at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
    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:4251)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
    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:644)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
    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 java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(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)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
mickaelistria commented 2 years ago

can you please list the details of the java processes running in your machine? Particularly the one mentioning lemminx?

ca-stefan-cordes commented 2 years ago

Mine is

"C:\swd\eclipse\eclipse.exe" -data c:\java\_head

with child

C:\swd\eclipse\\jdk-17.0.4.1-1-canda/bin/javaw.exe -Dosgi.requiredJavaVersion=11 -Dosgi.instance.area.default=@user.home/eclipse-workspace -Dsun.java.command=Eclipse -XX:+UseG1GC -XX:+UseStringDeduplication --add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=11 -Dosgi.dataAreaRequiresExplicitInit=true -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true -Xms256m -Xmx4g -Djdk.http.auth.tunneling.disabledSchemes= -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -Dhttps.protocols=TLSv1.2 -javaagent:lombok.jar -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Djavax.xml.accessExternalSchema=all -Dcom.sun.management.jmxremote -Dlog4j2.formatMsgNoLookups=true --add-modules=ALL-SYSTEM -Dcom.ibm.icu.util.TimeZone.DefaultTimeZoneType=ICU -jar C:\swd\eclipse\\plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -os win32 -ws win32 -arch x86_64 -showsplash C:\swd\eclipse\\plugins\org.eclipse.epp.package.common_4.24.0.20220609-1200\splash.bmp -launcher C:\swd\eclipse\eclipse.exe -name Eclipse --launcher.library C:\swd\eclipse\\plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.2.500.v20220509-0833\eclipse_11700.dll -startup C:\swd\eclipse\\plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar --launcher.appendVmargs -exitdata 8bc8_cc -product org.eclipse.epp.package.jee.product -plugincustomization plugin_customization.ini -data file:/C:/java/_head/ -vm C:\swd\eclipse\\jdk-17.0.4.1-1-canda/bin/javaw.exe -vmargs -Dosgi.requiredJavaVersion=11 -Dosgi.instance.area.default=@user.home/eclipse-workspace -Dsun.java.command=Eclipse -XX:+UseG1GC -XX:+UseStringDeduplication --add-modules=ALL-SYSTEM -Dosgi.requiredJavaVersion=11 -Dosgi.dataAreaRequiresExplicitInit=true -Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true -Xms256m -Xmx4g -Djdk.http.auth.tunneling.disabledSchemes= -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -Dhttps.protocols=TLSv1.2 -javaagent:lombok.jar -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Djavax.xml.accessExternalSchema=all -Dcom.sun.management.jmxremote -Dlog4j2.formatMsgNoLookups=true --add-modules=ALL-SYSTEM -Dcom.ibm.icu.util.TimeZone.DefaultTimeZoneType=ICU -jar C:\swd\eclipse\\plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar 

and one child:

C:\swd\eclipse\jdk-17.0.4.1-1-canda\bin\java.exe -Dhttps.proxyHost=localhost -Dhttps.proxyPort=3128 -Dhttp.proxyHost=localhost -Dhttp.nonProxyHosts=*.canda.biz|*.retail-sc.com|localhost|127.0.0.1|127.*|10.*|mule-worker-internal-*|*.internal|*.local|nexus.canda.com|test.nexus.canda.com|*.canda.services|*.int.canda.cloud|*.canda.eu|mail.canda.de -Dhttps.nonProxyHosts=*.canda.biz|*.retail-sc.com|localhost|127.0.0.1|127.*|10.*|mule-worker-internal-*|*.internal|*.local|nexus.canda.com|test.nexus.canda.com|*.canda.services|*.int.canda.cloud|*.canda.eu|mail.canda.de -Dhttp.proxyPort=3128 -classpath C:\swd\eclipse\configuration\org.eclipse.osgi\1028\0\.cp\language-servers\server\org.eclipse.lemminx-uber.jar;C:\swd\eclipse\configuration\org.eclipse.osgi\1026\0\.cp\lemminx-maven.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\aether-connector-okhttp-0.17.8.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\commons-cli-1.4.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\commons-io-2.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\commons-lang3-3.8.1.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\guice-4.2.2-no_aop.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\jansi-2.4.0.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\javax.annotation-api-1.2.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-artifact-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-builder-support-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-compat-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-core-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-embedder-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-model-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-model-builder-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-plugin-api-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-repository-metadata-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-api-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-connector-basic-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-impl-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-provider-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-spi-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-transport-wagon-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-resolver-util-1.6.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-settings-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-settings-builder-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-shared-utils-3.3.4.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\maven-slf4j-provider-3.8.6.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\okhttp-3.14.1.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\okio-1.17.3.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\org.eclipse.sisu.inject-0.3.5.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\org.eclipse.sisu.plexus-0.3.5.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-build-api-0.0.7.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-cipher-2.0.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-classworlds-2.6.0.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-component-annotations-2.1.0.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-interpolation-1.26.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-sec-dispatcher-2.0.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\plexus-utils-3.3.1.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\wagon-file-3.5.1.jar;C:\swd\eclipse\plugins\org.eclipse.m2e.maven.runtime_3.8.602.20220928-2220\jars\wagon-provider-api-3.5.1.jar;C:\swd\eclipse\plugins\javax.inject_1.0.0.v20220405-0441.jar;C:\swd\eclipse\plugins\org.slf4j.api_1.7.30.v20200204-2150.jar org.eclipse.lemminx.XMLServerLauncher
mickaelistria commented 2 years ago

OK thanks, so nothing obviously wrong here. Can you try a jstack on the latest process (the grand-child) when seeing such issue?

ca-stefan-cordes commented 2 years ago

Does JavaFlightRecorder help, too? Here one which had 5 timeouts while hovering over several dependencies in different pom.xmls

When Eclipse is running for a while less and less timeouts appear.

image

See flight_recording_17041orgeclipselemminxXMLServerLauncher24528.zip

bvo42 commented 1 year ago

I have the same problem. When working with the new Pom Editor I keep getting timeout warnings in the error log:

Workspace contains 220 Maven projects (Most of them linked with each other via class path. (Awesome m2e feature by the way.)

Tracking links, hover popup and the content assist stop working and slowing down the editor considerably. Unfortunately this affects the UX a lot (It's getting harder and harder for me to argue with the team why not move to IntelliJ).

After some time also the content formatter stops to work. But no hint about that in the error log. Eclipse needs to be restarted for it to work again.

timeout

mickaelistria commented 1 year ago

@bvo42 What you're showing here is an older version of m2e. Please update to latest release.

eliasbalasis commented 1 year ago

I am experiencing the same on Eclipse 2022-12 but only for about 1 minute after opening a pom.xml file. Then it starts working.

I suspect some background preparationis taking place, but it must be heavyweight.

Further observation reveals that this is most certainly due to slow interaction with the XML Language Server as the server stops when the last opened pom.xml is closed and it takes a long time for it to get back up and running again as soon as another pom.xml is opened before it can start interacting with the editor.

laeubi commented 1 year ago

While reading this one it mentioned:

just close all XML editors from child Eclipse IDE (that will stop the language server)

so if the server is stopped whenever all editors closing then this is really a bad thing regarding speed as this will mean in such scenario you always require a cold-start.

So maybe the importnat part here is to keep at laest one xml editor open ... beside that, I think closing the server right after the editor should probably better delayed a bit, e.g if it is not used for more than 5 minutes or something like that.

eliasbalasis commented 1 year ago

@laeubi , I mostly agree.

While working intensively with POMs an editor will be open but not always.

Inevitably, there will be times when any new POM editor will not be responsive for a significant amount of time. One minute can be a long time for those unaware of the underlying issue and can be misleading.

I am afraid the roots of the problem lie deeper into the Language Server implementation. I guess it could be forced to start with Eclipse and stay up and running but this could be memory consuming. I could equally suggest making the Language Server faster somehow but that may be impossible.

Keeping the Language Server up and running for a few minutes (propably a configurable value) could help but may not eliminate the problem perfectly.

Do you think the Language Server preparation can be made faster?

laeubi commented 1 year ago

I just wanted to make people aware that for "can't reproduce" or "sometimes fast sometimes slow" the actual number of editors open can be a point. Having a "restart" by indirectly closing all editors seems not something I would like to promote as a feature.

mickaelistria commented 1 year ago

I could equally suggest making the Language Server faster somehow but that may be impossible.

If you're willing to investigate, lemmix-maven would welcome contributions.