Code Monkey home page Code Monkey logo

Comments (11)

skybber avatar skybber commented on July 3, 2024

You are using pretty old version. I did not remember if we had hotswap synchronization in devm8.161, could you try TravaOpenJDK or later dcevm versions ?

from dcevm.

skybber avatar skybber commented on July 3, 2024

You can find them at https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08

from dcevm.

DaMatrix avatar DaMatrix commented on July 3, 2024

You can find them at https://github.com/TravaOpenJDK/trava-jdk-8-dcevm/releases/tag/dcevm8u282b08

Tested, the crash still occurs. hs_err_pid17877.log

from dcevm.

DaMatrix avatar DaMatrix commented on July 3, 2024

I should note that it is very inconsistent - sometimes the crash happens on the VM thread, sometimes it's on the JDWP thread, and the stack dump in the crash log isn't always exactly the same.

from dcevm.

skybber avatar skybber commented on July 3, 2024

dcevm11 has the same problem?

from dcevm.

DaMatrix avatar DaMatrix commented on July 3, 2024

My program doesn't run in Java >8, so I'll have to see if I can make a minimum reproducible example on that version.

from dcevm.

DaMatrix avatar DaMatrix commented on July 3, 2024

Okay, I've tested it on Java 11. It works fine on standard OpenJDK 11 again, but with DCEVM 11 the JDWP Transport Listener thread now hangs.

"JDWP Transport Listener: dt_socket" #20 daemon prio=10 os_prio=0 cpu=46.37ms elapsed=52.16s tid=0x00007fbaf4519800 nid=0xc6e runnable  [0x00007fbab15ef000]
   java.lang.Thread.State: RUNNABLE
	at sun.instrument.InstrumentationImpl.redefineClasses0([email protected]/Native Method)
	at sun.instrument.InstrumentationImpl.redefineClasses([email protected]/InstrumentationImpl.java:193)
	at org.spongepowered.tools.agent.MixinAgent$Transformer.reApplyMixins(MixinAgent.java:121)
	at org.spongepowered.tools.agent.MixinAgent$Transformer.transform(MixinAgent.java:72)
	at java.lang.instrument.ClassFileTransformer.transform([email protected]/ClassFileTransformer.java:246)
	at sun.instrument.TransformerManager.transform([email protected]/TransformerManager.java:188)
	at sun.instrument.InstrumentationImpl.transform([email protected]/InstrumentationImpl.java:563)

from dcevm.

skybber avatar skybber commented on July 3, 2024

What is the initiator of transform method? Is it redefinition in IDE? Why do you need call redefineClasses from transform? In case of HA we trigger redefinition e.g. of proxies in separate thread and since proxiesdepends on result of previous redefinion.

from dcevm.

DaMatrix avatar DaMatrix commented on July 3, 2024

It's initiated by the IDE, yes.

The agent is Mixin, a framework for doing Java bytecode changes at runtime. These modifications are described using a "mixin" class, containing code which is injected into the target class. When transform-ing a mixin class, the javaagent is able to re-apply the transformations by using a saved copy of the target class' original bytecode, and then calls redefineClasses to update the target class. To the best of my knowledge there's no other way to implement this, as the target class isn't being redefined by the IDE (since from the IDE's perspective, the only thing that changed is the mixin class).

I can delay the redefinition of target classes by queuing them on a different thread, but that's bad for two reasons:

  • There could be runtime errors if the old version of the target class references a member of some other class which was also removed, and would still be trying to access it before the second thread issues a reload
  • There's no decent way (that I'm aware of) to detect when the IDE's redefinition is complete other than just setting the other thread to run after a fixed delay of some number of seconds. Redefining the classes from a different thread still causes a segfault if the initial reload is still running, so the only solution is to sleep for some number of seconds and hope it's enough (which is also needlessly slow).

from dcevm.

skybber avatar skybber commented on July 3, 2024

I've added a lock to jvmti enhanced redefinition. Most likely it causes deadlock now if redefinition calls instrumentation transformer and it calls redefinition. Lock is necessary since we have use cases with redefinition triggered from multiple sources, advanced redefinition does a lot of preparation stuff out of safepoint.

from dcevm.

skybber avatar skybber commented on July 3, 2024

Unfortunately there is no "redefinition" event in jvmti. It would be great to create an extension for it, even it seems to not be so complicated and it would be helpful for HotswapAgent since it also depends on time delays. Also it would be nice to move this thread to HotswapAgent, since dcevm8 project is "EOL"

from dcevm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.