softwareCobbler / luceedebug

line debugger for lucee
GNU Lesser General Public License v2.1
44 stars 15 forks source link

Exception while attempting classfile rewrite #37

Open adm351 opened 1 year ago

adm351 commented 1 year ago

Hi, I'm getting the following in the last two releases of luceedebug

[luceedebug] exception during attempted classfile rewrite org/apache/felix/framework/Felix java.lang.ClassCircularityError: org/apache/felix/framework/Felix

It looks like its trying to load the one wrapped here https://github.com/softwareCobbler/luceedebug/blob/master/luceedebug/src/main/java/luceedebug/instrumenter/Felix.java as well as the main one. I've tried ignoring the default one with my class loader without success.

softwareCobbler commented 1 year ago

Hi, sorry to hear it. Can you list your relevant configuration, which is a tuple of (os version, lucee version, jdk version, lucee config, jvm config)? The request for Lucee and JVM config is sort of handwavingly "stuff that might be a bit out of the ordinary", like other java agents also loaded, additional OSGi config, or whatever.

You don't happen to have a docker container that reproduces this, do you? That would make this easier to track down.

The issue is with "the last two releases", implying there is some commit which works, and then the subsequent commit fails. We don't really have a standardized release tagging strategy, so I'm not 100% certain which commits you are referring to -- can you specify the last known good commit on your end?

adm351 commented 1 year ago

Thanks for getting back to me. Its not that I have a working vs not working commit of luceedebug just that I tried multiple releases of luceedebug where the handling of Felix changed to see if it was a recent changed that caused the issue.

I can't share the Dockerfile unfortunately but its using:

We are running standard Tomcat classloader etc.

I've checked, I only have org/apache/felix/framework/Felix and org/apache/felix/framework/FrameworkFactory classes in my loader within LuceeTransformer.transform()


Update: fusion reactor was also wrapping Felix and that's where the duplicate was coming from. Now I'm seeing that Felix isn't part of the URL class loader but I believe that's because it can't cast the wrapped Felix with what it expects. Ill investigate further. By the way, is there a minimum version of lucee supported by this plug-in?

softwareCobbler commented 1 year ago

I think this is a conflict with FusionReactor. I was aware we both contend for JVMTI permissions, but it seems we also both do things that affect Felix. Can you give it a try without the FusionReactor agent?

(edit: ah, it seems you noticed this too)

RE: minimum Lucee version -- not sure, I develop this against 5.3.* though, which is what I use at $DAYJOB.

carehart commented 1 year ago

@adm351 Or try it without the agentpath arg that fr implements (or suggests you implement) but leave the javaagent.

I'm not saying I've tried this specifically with luceedebug, though I'm pretty sure I've had fr configured this way with ACF--where the agentpath for ACF's debugging feature was implemented (and not FR's, thus foregoing FR's debugger in favor of ACF's).