IntelliJ 2020.3 integration

Questions about YourKit Java Profiler
Locked
dancioca
Posts: 2
Joined: Fri Jan 15, 2021 5:58 pm

IntelliJ 2020.3 integration

Post by dancioca »

Just installed YourKit java profiler on my IntelliJ (2020.3 Ultimate) workspace and first thing I see when invoking profiler is:
Cannot launch: it's impossible to automatically detect whether a 32-bit or a 64-bit JVM will be used
in order to supply appropriate profiler agent version.
To solve the problem, explicitly choose the JVM kind in the YourKit plugin configuration settings.
Looking at "Run/Debug Configurations > Startup/Connection > Profile > 32-bit or 64-bit JRE Selection"
Selecting 64...

Starting profiling again.. same error
Opening the settings above again, my JRE option is not saved. Non of my configuration changes get saved in the yourkit run configuration section.

Anyone else experiencing this?
Trying to evaluate this thing and first I get presented with is this annoying "it's impossible to detect"...
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: IntelliJ 2020.3 integration

Post by Anton Katilin »

If the plugin options are not saved, this should be a regression in IntelliJ IDEA. We'll investigate.

Regarding the bitness selection problem itself:

1. Which profiler version do you use?
2. Please re-run the IDE integration wizard from the profiler Welcome screen to ensure the latest plugin is installed.
3. Please provide content of the profiler plugin log file <user home>/.yjp/log/ide-plugin.log
dancioca
Posts: 2
Joined: Fri Jan 15, 2021 5:58 pm

Re: IntelliJ 2020.3 integration

Post by dancioca »

Hi Anton,
tanks for the replay.

I am using Profiler version 2020.9-b416 (probably the last one out there)
IDE integration retry did not help.

Probably worth mentioning, I am trying to profile an intelliJ Plugin, which has a JetBrains SDK behind, with a java SDK attached to it. The plugin seems to be looking for a java.exe file in the JetBrains SDK home (which is the installation of the IntelliJ itself).

Output from ide-pluin.log

Code: Select all

Tue Jan 19 11:15:34 CET 2021 [YourKit Java Profiler 2020.9-b416] com.yourkit.t.f: com.yourkit.af.bg: Cannot execute command:
  C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE\bin\java.exe
  -version

Cause: java.io.IOException: Cannot run program "C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE\bin\java.exe": CreateProcess error=2, The system cannot find the file specified
	at com.yourkit.af.bh.c(a:154)
	at com.yourkit.af.bh.aeC(a:140)
	at com.yourkit.af.bh.aeA(a:99)
	at com.yourkit.t.f.dm(a:59)
	at com.yourkit.t.f.a(a:42)
	at com.yourkit.idea14_1Plugin.MyRunner.a(a:84)
	at com.yourkit.idea14_1Plugin.MyRunner.patch(a:54)
	at com.intellij.execution.impl.DefaultJavaProgramRunner.patchJavaCommandLineParams(DefaultJavaProgramRunner.java:140)
	at com.intellij.execution.impl.DefaultJavaProgramRunner.doExecute(DefaultJavaProgramRunner.java:131)
	at com.intellij.execution.impl.DefaultJavaProgramRunner.lambda$execute$1(DefaultJavaProgramRunner.java:116)
	at com.intellij.execution.ExecutionManager$startRunProfile$1.invoke(ExecutionManager.kt:65)
	at com.intellij.execution.ExecutionManager$startRunProfile$1.invoke(ExecutionManager.kt:19)
	at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:155)
	at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:65)
	at com.intellij.execution.impl.ExecutionManagerImpl$doStartRunProfile$startRunnable$1.run(ExecutionManagerImpl.kt:216)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:216)
	at com.intellij.openapi.application.TransactionGuardImpl.access$200(TransactionGuardImpl.java:24)
	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:199)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822)
	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:324)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:85)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:134)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:190)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:976)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:843)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:454)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:773)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:453)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:822)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:501)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Caused by: java.io.IOException: Cannot run program "C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE\bin\java.exe": CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1128)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1071)
	at com.yourkit.af.bh.c(a:151)
	... 43 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
	at java.base/java.lang.ProcessImpl.create(Native Method)
	at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:478)
	at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:154)
	at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1107)
	... 45 more
Thanks for your support!
Dan
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: IntelliJ 2020.3 integration

Post by Anton Katilin »

Hello Dan,
I am trying to profile an intelliJ Plugin, which has a JetBrains SDK behind, with a java SDK attached to it. The plugin seems to be looking for a java.exe file in the JetBrains SDK home (which is the installation of the IntelliJ itself).
This is the problem. The bundled JRE does not have a Java executable (it's allowed for a private JRE not to bundle some unnecessary files), thus the plugin is unable to detect its version by probing the output of "java -version".

If possible, please try running the plugin under a standalone JVM.

Alternatively, you can enable profiling manually by specifying corresponding -agentpath VM parameter in the run configuration and using the action "Run". The simplest way to generate the parameter is to use "Profile local Java EE server or application" on the profiler's Welcome screen and choose the "Other Java application" option.

Regarding the initial problem that IDEA does not remember the bitness option. We cannot reproduce it. It seems it is specific to the run configuration type you use. What kind of IDEA project do you have? Can you provide a screenshot of Run/Debug dialog showing your configuration in the list?

Best regards,
Anton
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: IntelliJ 2020.3 integration

Post by Anton Katilin »

> The bundled JRE does not have a Java executable

Correction: the JRE does have java.exe in "C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE\jbr\bin". However, IDEA returns its upper level directory "C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE" instead of expected "C:\Programs\JetBrains\IntelliJ IDEA 20.3 CE\jbr" from the method com.intellij.execution.configurations.JavaParameters.getJdkPath() which the plugin uses. This method getJdkPath() does not have Javadoc so it's unclear if it's a bug or intended behavior.
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: IntelliJ 2020.3 integration

Post by Anton Katilin »

Update:

We managed to reproduce the problem with a new project of type "IntelliJ Platform Plugin". The problem has been reported as https://youtrack.jetbrains.com/issue/IDEA-259779
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: IntelliJ 2020.3 integration

Post by Anton Katilin »

Update:

We released YourKit Java Profiler 2020.9 build #419 which should automatically choose appropriate JRE bitness in your case. The "Profile" action should work.
Locked