Class transforming agent, and strange dependent classes

P

Piotr Kobzda

Hi all,

I've got some problem with my Java instrumentation agent transforming
classes while theirs load by the JVM.

The agent is quite simple. It registers a transformer
(ClassFileTransformer) that transforms classes (using ObjectWeb ASM),
and then, in a case of changing a class, returns its new bytes back to
the JVM.

The problem is that the agent normally hangs the JVM.


My hypothesis is that the reason is looping a transformations chain.
That is registered transformer, while working, causes a load of some
additional classes, which in turn causes a transformation of these
classes, and then causes a deadlock.

That hypothesis seems to be true because of temporary solution I've
discovered, i.e. an initialization of the sun.misc.Cleaner class (found
in a dump of hanged JVM) before registration of the transformer solves
the problem.

That dependency doesn't looks so nice to me (the above class isn't
directly used by me, nor by ASM), and I'd like to remove it. However,
whatever I try to do, I can not cause the JVM to start without explicit
initialization of that strange class.


Does anyone experienced this (or similar) problem, and/or knows how to
solve it nicely?


piotr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top