TravaOpenJDK / trava-jdk-11-dcevm

dcevm-11 built on Travis
Apache License 2.0
403 stars 57 forks source link

Java Flight Recorder not possible with DCEVM ? #35

Closed alain57 closed 3 years ago

alain57 commented 3 years ago

Hi, i own an intellij ultimate license and use the inbuilt profiler to analyse what needs to be improved. On windows the default profiler is Java Flight Recorder and with JDK 11 downloaded from adoptopenjdk there is no issue.

However when I try to use the JDK provided here, somehow i get following error when trying to profile my app

Can't attach profiler: Unexpected response from 'JFR.start': 'class sun.nio.ch.FileChannelImpl$Closer tried to access private field sun.nio.ch.FileChannelImpl.fdAccess (sun.nio.ch.FileChannelImpl$Closer and sun.nio.ch.FileChannelImpl are in module java.base of loader 'bootstrap')'.

is there any incompatiblity between this JDK and flight recorder ? Or do i need some specific arguments to run it ?

skybber commented 3 years ago

Most likely it is bug, I'll look at it.

skybber commented 3 years ago

Problem is fixed in latest release - EnhancedRedefinition is disabled if -XX:+FlightRecorder is used

https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases

alain57 commented 3 years ago

Hi, thanks for the fix.

Unfortunately there seems to still be an issue. Of course I put the -XX:+FlightRecorder argument. But as soon as I try to attach the profiler to the running project I got the message

Cannot attach the profiler: Unexpected response from 'JFR.start': 'class sun.nio.ch.FileChannelImpl$Closer tried to access private field sun.nio.ch.FileChannelImpl.fdAccess (sun.nio.ch.FileChannelImpl$Closer and sun.nio.ch.FileChannelImpl are in module java.base of loader 'bootstrap')'.

If i try running it directly with the flight recorder run icon i got following output

Dynamic Code Evolution 64-Bit Server VM warning: EnhancedClassRedefinition was disabled, it is not allowed in FlightRecorder. HOTSWAP AGENT: 14:27:24.380 INFO (org.hotswap.agent.HotswapAgent) - Loading Hotswap agent {1.4.1} - unlimited runtime class redefinition. HOTSWAP AGENT: 14:27:24.735 INFO (org.hotswap.agent.config.PluginRegistry) - Discovered plugins: [JdkPlugin, Hotswapper, WatchResources, ClassInitPlugin, AnonymousClassPatch, Hibernate, Hibernate3JPA, Hibernate3, Spring, Jersey1, Jersey2, Jetty, Tomcat, ZK, Logback, Log4j2, MyFaces, Mojarra, Omnifaces, ELResolver, WildFlyELResolver, OsgiEquinox, Owb, Proxy, WebObjects, Weld, JBossModules, ResteasyRegistry, Deltaspike, GlassFish, Vaadin, Wicket, CxfJAXRS, FreeMarker, Undertow, MyBatis] class sun.nio.ch.FileChannelImpl$Closer tried to access private field sun.nio.ch.FileChannelImpl.fdAccess (sun.nio.ch.FileChannelImpl$Closer and sun.nio.ch.FileChannelImpl are in module java.base of loader 'bootstrap') Error occurred during initialization of VM Failure when starting JFR on_create_vm_3 Starting HotswapAgent 'D:\install\software\java\dcevm-11.0.10+2\lib\hotswap\hotswap-agent.jar'

Process finished with exit code 1

for information my VM settings are following:

-XX:HotswapAgent=fatjar -XX:+FlightRecorder -XX:FlightRecorderOptions=stackdepth=128 -XX:FlightRecorderOptions=samplethreads=true -XX:-DisableAttachMechanism -Xmx1G --add-opens java.base/jdk.internal.module=ALL-UNNAMED -Dintellij.debug.agent=true

skybber commented 3 years ago

May be the problem is in HotswapAgent, could you try disable HA using -XX:HotswapAgent=disabled ?

alain57 commented 3 years ago

sorry for the delay i was sick and allmost never on my computer. Yes when disabling hotswapAgent it works :/