dosubot[bot] commented on issue #2654:
URL: 
https://github.com/apache/incubator-hugegraph/issues/2654#issuecomment-2323617921

   <!-- Answer -->
   The `PerfUtilTest` failures you're encountering with multiple 
`java.lang.LinkageError` exceptions are due to class loading conflicts. This 
typically happens when there are multiple versions of the same class loaded by 
different class loaders, leading to `LinkageError`.
   
   To resolve this issue, you should ensure that:
   1. There is only one instance of `PerfUtil` being used.
   2. The class loading is properly managed and synchronized.
   3. Any dynamic class loading or reflection is handled carefully to avoid 
conflicts.
   
   Here is a snippet from the `PerfUtilTest` class that shows the usage of 
`PerfUtil`:
   
   ```java
   public class PerfUtilTest extends BaseUnitTest {
   
       private static final String prefix = 
"org.apache.hugegraph.unit.perf.testclass.";
       private static final PerfUtil perf = PerfUtil.instance();
   
       @After
       public void teardown() {
           perf.clear();
       }
   
       @Test
       public void testPerfUtil() throws Throwable {
           perf.profileClass(prefix + "TestClass$Foo");
   
           TestClass.Foo obj = new TestClass.Foo();
           obj.foo();
   
           perf.toString();
           perf.toECharts();
           String json = perf.toJson();
   
           assertContains(json, "foo.foo#times", 1);
           // Other assertions...
       }
   
       // Other test methods...
   }
   ```
   
   Ensure that the `PerfUtil` instance is not causing class loading conflicts 
and that the test environment is clean and isolated to prevent such issues 
<sup>[[1]](https://github.com/apache/incubator-hugegraph/blob/master/hugegraph-commons/hugegraph-common/src/test/java/org/apache/hugegraph/unit/perf/PerfUtilTest.java)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to