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

IntelliJ plugin fails with message "Canceled" only on Java projects. #160

Closed
hellwigt-eq opened this issue Sep 22, 2023 · 15 comments
Closed
Labels
bug Something isn't working

Comments

@hellwigt-eq
Copy link

Bug Description

I've been using the mirrord plugin with Intellij successfully with Python projects for some time now, but just tried to run it with a Java project today, and it fails instantly with this cryptic popup:
image
or this:
image

I verified that it's not project specific, this is repeatable on a blank brand new Java project.

Steps to Reproduce

  1. In IntelliJ select File >> New Project.
  2. In the New Project popup, leave all settings at default and click "Create".
  3. Click the mirrord icon in the top bar of the IDE to enable it for this new project.
  4. Click the green Run triangle or Debug icon to the right of the mirrord menu in the top bar to launch the project.
  5. The project builds and then fails immediately.

Backtrace

No response

Relevant Logs

2023-09-22 18:20:20,672 [  21013]   INFO - #c.i.c.ComponentStoreImpl - Saving Project(name=test, containerState=COMPONENT_CREATED, componentStore=/var/home/hellwigt/dev/test)RunManager took 33 ms
2023-09-22 18:20:20,673 [  21014]   INFO - #c.i.w.i.i.j.s.JpsGlobalModelSynchronizerImpl - Saving global entities to files
2023-09-22 18:20:20,805 [  21146]   INFO - #c.i.c.i.CompileDriver - COMPILATION STARTED (BUILD PROCESS)
2023-09-22 18:20:21,009 [  21350]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: An illegal reflective access operation has occurred
2023-09-22 18:20:21,009 [  21350]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Illegal reflective access by com.intellij.openapi.diagnostic.JulLogger (file:/var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/lib/util-8.jar) to field java.lang.ApplicationShutdownHooks.hooks
2023-09-22 18:20:21,010 [  21351]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Please consider reporting this to the maintainers of com.intellij.openapi.diagnostic.JulLogger
2023-09-22 18:20:21,010 [  21351]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2023-09-22 18:20:21,010 [  21351]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: All illegal access operations will be denied in a future release
2023-09-22 18:20:21,050 [  21391]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/plugins/java/lib/jps-launcher.jar
2023-09-22 18:20:21,282 [  21623]   INFO - #o.j.k.i.s.r.KotlinCompilerReferenceIndexStorage - KCRI storage is closed (didn't exist)
2023-09-22 18:20:21,282 [  21623]   INFO - #c.i.c.b.CompilerReferenceServiceBase - backward reference index reader is closed (didn't exist)
2023-09-22 18:20:21,777 [  22118]   INFO - #o.j.k.i.s.r.KotlinCompilerReferenceIndexService - initialized
2023-09-22 18:20:21,778 [  22119]   WARN - #o.j.k.i.s.r.KotlinCompilerReferenceIndexStorage - kotlin-data-container is not found
2023-09-22 18:20:21,778 [  22119]   INFO - #c.i.c.b.CompilerReferenceServiceBase - initialized
2023-09-22 18:20:21,779 [  22120]   INFO - #c.i.c.b.CompilerReferenceServiceBase - backward reference index reader doesn't exist
2023-09-22 18:20:21,805 [  22146]   INFO - #c.i.c.i.CompilerUtil - 	COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 1335 ms: 0 min 1sec
2023-09-22 18:20:21,814 [  22155]   INFO - #c.i.u.t.DateFormatUtil - cannot load system formats (JNA=true), resorting to JRE for en
2023-09-22 18:20:21,849 [  22190]   INFO - mirrord - running mirrord task with following command line: /home/linuxbrew/.linuxbrew/bin/mirrord ls -o json
2023-09-22 18:20:21,895 [  22236]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: An illegal reflective access operation has occurred
2023-09-22 18:20:21,895 [  22236]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Illegal reflective access by com.intellij.openapi.diagnostic.JulLogger (file:/var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/lib/util-8.jar) to field java.lang.ApplicationShutdownHooks.hooks
2023-09-22 18:20:21,895 [  22236]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Please consider reporting this to the maintainers of com.intellij.openapi.diagnostic.JulLogger
2023-09-22 18:20:21,895 [  22236]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2023-09-22 18:20:21,895 [  22236]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stderr]: WARNING: All illegal access operations will be denied in a future release
2023-09-22 18:20:21,923 [  22264]   INFO - #c.i.c.s.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: /var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/plugins/java/lib/jps-launcher.jar
2023-09-22 18:20:22,137 [  22478]   INFO - #c.i.e.r.ExecutionUtil - Error running 'Main':<br>Canceled
org.jetbrains.concurrency.MessageError: Canceled

Your operating system and version

Fedora 38 Silverblue

Local process

No idea, I'm just clicking the run/debug icons on a default java project.

Local process version

No response

Additional Info

No response

@hellwigt-eq hellwigt-eq added the bug Something isn't working label Sep 22, 2023
@hellwigt-eq hellwigt-eq changed the title IntelliJ plugin fails with message "Cancelled" only on Java projects. IntelliJ plugin fails with message "Canceled" only on Java projects. Sep 22, 2023
@aviramha
Copy link
Member

Sorry to hear about the issue - I'm pretty sure the reason you get it is because you didn't specify target in your mirrord config file. When running Java applications, our plugin can't show the interactive dialog so you have to specify it in the config file.
The plugin should show a message that explains that, and if it didn't that's an issue.
Can you try specifying target in your mirrord.json file and let us know if it works so we'll understand if it's a UX bug or something different?

@aviramha aviramha transferred this issue from metalbear-co/mirrord Sep 23, 2023
@hellwigt-eq
Copy link
Author

hellwigt-eq commented Sep 25, 2023

I set the target to a specific pod in the config, and now it fails but with a different error message. The popups says "mirrord failed" now instead of "Canceled", and the IntelliJ logs show a little more. Here's the relevant IntelliJ logs output.

2023-09-25 14:06:39,008 [242648785] INFO - #c.i.e.r.ExecutionUtil - Error running 'Main':<br>mirrord failed com.metalbear.mirrord.MirrordError: mirrord failed at com.metalbear.mirrord.MirrordError$Companion.fromStdErr(MirrordError.kt:24) at com.metalbear.mirrord.MirrordApi$MirrordExtTask.compute(MirrordApi.kt:174) at com.metalbear.mirrord.MirrordApi$MirrordExtTask.compute(MirrordApi.kt:134) at com.metalbear.mirrord.MirrordCliTask.computeWithResponsiveCancel$lambda$8(MirrordApi.kt:341) at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:272) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at com.intellij.util.concurrency.ContextCallable.call(ContextCallable.java:29) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:24) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) at java.base/java.lang.Thread.run(Thread.java:833)

Also, here's what my mirrord.json file looks like: { "feature": { "network": { "incoming": "mirror", "outgoing": true }, "fs": "read", "env": true }, "target": { "path": { "pod": "knowledge-base-api-869666d7d7-5kn77" }, "namespace": "fusion" } }

@hellwigt-eq
Copy link
Author

hellwigt-eq commented Sep 25, 2023

Oops, I think I had the wrong context set while trying to run with that target, so probably was failing because the pod name was wrong. Switching to the right context, I now get this error instead:

`/var/home/hellwigt/.sdkman/candidates/java/11.0.20-amzn/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55755,suspend=y,server=n -javaagent:/var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/plugins/java/lib/rt/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath /var/home/hellwigt/dev/untitled/out/production/untitled:/var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/lib/idea_rt.jar Main
Error opening zip file or JAR manifest missing : /var/home/hellwigt/.local/share/JetBrains/Toolbox/apps/intellij-idea-ultimate/plugins/java/lib/rt/debugger-agent.jar
Error occurred during initialization of VM
agent library failed to init: instrument

Process finished with exit code 1
`

Seems like another configuration issue I'm missing? Just not sure what.

@aviramha
Copy link
Member

I assume it's trying to load the JAR from the remote pod.
You can try two things:

  1. Exclude jar files (we'll add it as default soon exclude jar files mirrord#1968 ):
{
    "feature": {
        "fs": {
            "local": ["\\.jar$"]
        }
    }
}
  1. Turn off file system (if possible)
{
    "feature": {
        "fs": "localwithoverrides"
    }
}

@hellwigt-eq
Copy link
Author

Went straight to the 2nd option, since I don't need remote file system. Worked like a charm! Thank you.
I'd guess more descriptive error messages in the plugin and adding this config info as a required prereq setup for Java in the documentation would do the trick for future users.

@aviramha
Copy link
Member

Went straight to the 2nd option, since I don't need remote file system. Worked like a charm! Thank you. I'd guess more descriptive error messages in the plugin and adding this config info as a required prereq setup for Java in the documentation would do the trick for future users.

I'm quite not sure how come you didn't get the other error messages - any case you missed those? IntelliJ might stack it for you - can you make sure you don't see those anywhere?

@hellwigt-eq
Copy link
Author

Yep, didn't see any other error messages anywhere. Even the idea.log file didn't have anything for that last issue of the missing JAR file. Plugin version is 3.55.0.

@aviramha
Copy link
Member

Can you tell us if it still happens, and if it does, would you be kind to jump on a call to debug together as we can't manage to reproduce it on our end?

@hellwigt-eq
Copy link
Author

Yeah, so to recap, the issue I encountered here was that I'm unable to run a java microservice with mirrord without specifying a target pod, and also setting "fs": "localwithoverrides". This is still the same behavior I'm experiencing today. It would be convenient to be able to run java microservices without specifying a target, so definitely happy to help debug that as availability allows.

@aviramha
Copy link
Member

aviramha commented Jan 4, 2024

Hey @hellwigt-eq - the problem is that we can't show a dialog from the extension point IntelliJ provides, so it's not really fixable from our side.
I'd be happy to debug the requirement for "localwithoverrides" - feel free to schedule time here https://calendly.com/aviram-5/30min

@hellwigt-eq
Copy link
Author

I also run python microservices within intellij (not pycharm) with mirrord and those can run targetless. Does intellij do something different for python than java?

@aviramha
Copy link
Member

aviramha commented Jan 4, 2024

Yes, each run configuration provides different extensionpoint we use to provide our functionality.
For example, Python extensions:
https://github.com/metalbear-co/mirrord-intellij/blob/main/src/main/resources/META-INF/mirrord-pycharm.xml
IDEA:
https://github.com/metalbear-co/mirrord-intellij/blob/main/src/main/resources/META-INF/mirrord-idea.xml

@hellwigt-eq
Copy link
Author

Would setting it to run targetless when a target isn't specified in the config file be a sane option, rather than having it fail?

@aviramha
Copy link
Member

aviramha commented Jan 4, 2024

I think it'd be a weird behavior that can confuse users even more (since app will launch in weird configuration)
You can suggest it in a different issue and we can see if others agree though

@aviramha aviramha closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2024
@aviramha
Copy link
Member

aviramha commented Jan 5, 2024

We've opened an issue upstream, please upvote it on YouTrack to make JetBrains help us :)
https://youtrack.jetbrains.com/issue/MP-6196/Threading-issues-with-RunConfigurationExtension
And it's now tracked here
#219

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants