jenkinsci / idea-stapler-plugin

Jenkins Development Support for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/1885-jenkins-development-support/
BSD 2-Clause "Simplified" License
9 stars 19 forks source link

StackOverflowError when opening Jelly file #88

Closed wheelerlaw closed 2 years ago

wheelerlaw commented 2 years ago

Jenkins and plugins versions report

  IntelliJ IDEA 2021.3.2 (Ultimate Edition)
Build #IU-213.6777.52, built on January 27, 2022
Licensed to Wheeler Law
Subscription is active until March 17, 2022.
Runtime version: 11.0.13+7-b1751.25 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.16.8-200.fc35.x86_64
GC: G1 Young Generation, G1 Old Generation
Memory: 1966M
Cores: 8
Registry:
    debugger.watches.in.variables=false
    go.run.processes.with.pty=false

Non-Bundled Plugins:
    org.toml.lang (213.5744.224)
    ru.sadv1r.ansible-vault-editor-idea-plugin (1.17)
    org.jetbrains.plugins.vagrant (213.5744.121)
    org.jetbrains.plugins.go (213.6777.52)
    nix-idea (0.4.0.2)
    net.sjrx.intellij.plugins.systemdunitfiles (0.3.4)
    net.seesharpsoft.intellij.plugins.csv (2.18.2)
    name.kropp.intellij.makefile (213.5744.224)
    com.perl5 (2021.3.1)
    com.intellij.nativeDebug (213.6461.6)
    org.jetbrains.plugins.ruby (213.6777.38)
    com.intellij.guice (213.6461.21)
    com.github.camork.fileExpander (1.7)
    com.github.b3er.idea.plugins.arc.browser (0.23)
    org.asciidoctor.intellij.asciidoc (0.36.13)
    String Manipulation (8.25.203.5981.1)
    Stapler plugin for IntelliJ IDEA (2.0.4)
    mobi.hsz.idea.gitignore (4.3.0)
    org.rust.lang (0.4.164.4409-213)
    intellij.prettierJS (213.6461.6)
    Pythonid (213.6777.52)
    org.exbin.deltahex.intellij (0.2.5)
    com.intellij.kubernetes (213.6777.8)
    Dart (213.5744.122)
    io.flutter (63.2.4)
    com.intellij.plugins.html.instantEditing (213.5744.122)
    CMD Support (1.0.5)
    ru.adelf.idea.dotenv (2022.1)
    com.thoughtworks.gauge (213.5744.125)
    org.intellij.scala (2021.3.18)
    izhangzhihao.rainbow.brackets (6.21)

Kotlin: 213-1.5.10-release-949-IJ6777.52
Current Desktop: GNOME

What Operating System are you using (both controller, and any agents involved in the problem)?

Fedora 35

Reproduction steps

  1. Clone the Jenkins core repo (git clone https://github.com/jenkinsci/jenkins.git).
  2. Open up a Jelly file (core/src/main/resources/lib/layout/layout.jelly for example).
  3. Get IDE error

Expected Results

No error to be thrown

Actual Results

The following error was thrown (full stacktrace in pastebin):

java.lang.StackOverflowError
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
    at java.base/java.util.concurrent.ForkJoinTask.reportException(ForkJoinTask.java:678)
    at java.base/java.util.concurrent.ForkJoinTask.join(ForkJoinTask.java:722)
    at com.intellij.concurrency.JobLauncherImpl.processQueue(JobLauncherImpl.java:357)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.processInOrder(LocalInspectionsPass.java:414)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.visitPriorityElementsAndInit(LocalInspectionsPass.java:357)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.inspect(LocalInspectionsPass.java:227)
    at com.intellij.codeInsight.daemon.impl.LocalInspectionsPass.collectInformationWithProgress(LocalInspectionsPass.java:127)
    at com.intellij.codeInsight.daemon.impl.ProgressableTextEditorHighlightingPass.doCollectInformation(ProgressableTextEditorHighlightingPass.java:84)
    at com.intellij.codeHighlighting.TextEditorHighlightingPass.collectInformation(TextEditorHighlightingPass.java:56)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$1(PassExecutorService.java:414)
    at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1084)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$doRun$2(PassExecutorService.java:407)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.doRun(PassExecutorService.java:406)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.lambda$run$0(PassExecutorService.java:382)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.executeByImpatientReader(ReadMostlyRWLock.java:174)
    at com.intellij.openapi.application.impl.ApplicationImpl.executeByImpatientReader(ApplicationImpl.java:181)
    at com.intellij.codeInsight.daemon.impl.PassExecutorService$ScheduledPass.run(PassExecutorService.java:380)
    at com.intellij.concurrency.JobLauncherImpl$VoidForkJoinTask$1.exec(JobLauncherImpl.java:184)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.StackOverflowError
    at java.base/java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
    at com.intellij.openapi.roots.impl.PackageDirectoryCache.getPackageInfo(PackageDirectoryCache.java:57)
    at com.intellij.openapi.roots.impl.PackageDirectoryCache.getDirectoriesByPackageName(PackageDirectoryCache.java:52)
    at com.intellij.openapi.roots.impl.RootIndex.getDirectoriesByPackageName(RootIndex.java:713)
    at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getDirectoriesByPackageName(DirectoryIndexImpl.java:131)
    at com.intellij.openapi.roots.impl.ProjectPackageIndexImpl.getDirsByPackageName(ProjectPackageIndexImpl.java:32)
    at com.intellij.psi.impl.file.impl.JavaFileManagerImpl.findPackage(JavaFileManagerImpl.java:65)
    at com.intellij.psi.impl.PsiElementFinderImpl.findPackage(PsiElementFinderImpl.java:58)
    at com.intellij.psi.impl.JavaPsiFacadeImpl.findPackage(JavaPsiFacadeImpl.java:199)
    at org.kohsuke.stapler.idea.descriptor.XmlNSDescriptorImpl.get(XmlNSDescriptorImpl.java:140)
    at org.kohsuke.stapler.idea.descriptor.XmlNSDescriptorImpl.get(XmlNSDescriptorImpl.java:127)
    at org.kohsuke.stapler.idea.descriptor.XmlElementDescriptorImpl.getElementDescriptor(XmlElementDescriptorImpl.java:35)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getDescriptorFromParent(XmlNSDescriptorImpl.java:162)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getElementDescriptor(XmlNSDescriptorImpl.java:787)
    at org.kohsuke.stapler.idea.descriptor.XmlElementDescriptorImpl.getElementDescriptor(XmlElementDescriptorImpl.java:54)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getDescriptorFromParent(XmlNSDescriptorImpl.java:162)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getElementDescriptor(XmlNSDescriptorImpl.java:787)
    at org.kohsuke.stapler.idea.descriptor.XmlElementDescriptorImpl.getElementDescriptor(XmlElementDescriptorImpl.java:54)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getDescriptorFromParent(XmlNSDescriptorImpl.java:162)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getElementDescriptor(XmlNSDescriptorImpl.java:787)
    at org.kohsuke.stapler.idea.descriptor.XmlElementDescriptorImpl.getElementDescriptor(XmlElementDescriptorImpl.java:54)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getDescriptorFromParent(XmlNSDescriptorImpl.java:162)
    at com.intellij.xml.impl.schema.XmlNSDescriptorImpl.getElementDescriptor(XmlNSDescriptorImpl.java:787)
    at org.kohsuke.stapler.idea.descriptor.XmlElementDescriptorImpl.getElementDescriptor(XmlElementDescriptorImpl.java:54)
        ...repeated hundreds of times

Anything else?

No response

duemir commented 2 years ago

Probably a duplicate of #66. It looks slightly different but I suspect the same root cause.

duemir commented 2 years ago

@wheelerlaw I tried to fix the StackOverflowError in #99. I use it locally and have yet to see a StackOverflowError report. But I am mostly browsing the plugins, not writing them, so I cannot claim that nothing regressed. If you can test would be nice.

You can checkout the PR and then dow ./gradlew buildPlugin. This should create build/distributions/idea-stapler-plugin-2.0.7-SNAPSHOT.zip, which can be installed from disk https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk