Fully featured low overhead profiler for Java EE and Java SE platforms.
Performance monitoring and profiling of Jenkins, TeamCity, Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

Probe registers multiple method invocations

Moderators: Vladimir Kondratyev, Anton Katilin

Probe registers multiple method invocations

Postby perehnbom » Fri Nov 25, 2011 10:39 am

I have a probe registering method invocations. In some cases yourkit registers 2 invocations when only one method call is executed.

This is the probe I have:
Code: Select all
@MethodPattern({"mydomain.webapp.integration.MyServiceFacade:*(*)"})
public class JspProbe {
   
    public static long onEnter(@MethodName String methodSignature, @This Object object) {       
       if(methodSignature.contains("getAccountDTO")){
          System.out.println("ENTER |"+object +"|"+methodSignature+"|" + "( "+System.nanoTime()+")");
       }
        return System.nanoTime();
    }
 
    public static void onReturn(@OnEnterResult long enterTime, @MethodName String methodSignature, @MethodParameterTypes String methodParameterTypes, @This Object object) {              
       
       if(methodSignature.contains("getAccountDTO")){
          System.out.println("RETURN |"+object +"|"+methodSignature+"|" + "( "+System.nanoTime()+")");
       }          
    }
}


The method in MyServiceFacade that executes the code is the following:
Code: Select all
       public List<AccountDTO> getAccountDTOs(final List<AccountId> accountIds){
       System.out.println("executing getAccountAndPositionsDTOs");
       return new ArrayList<AccountDTO>() 
    }



And the outprint from the log is the following, which clearly shows that the method is executed once but the probe registers 2 calls.
Code: Select all
ENTER |mydomain.webapp.integration.MyServiceFacade@557497f2|getAccountDTOs|( 1558167984511865)
ENTER |mydomain.webapp.integration.MyServiceFacade@557497f2|getAccountDTOs|( 1558167991299882)
executing getAccountAndPositionsDTOs
RETURN |mydomain.webapp.integration.MyServiceFacade@557497f2|getAccountDTOs|( 1558167991458486)
RETURN |mydomain.webapp.integration.MyServiceFacade@557497f2|getAccountDTOs|( 1558167991774539)



The behaviour happens for some calls like this one, while most similar calls are registered correctly. If I change the method pattern and add the method name to it, the probe registers only one call:
Code: Select all
@MethodPattern({"mydomain.webapp.integration.MyServiceFacade:getAccountDTO(*)"})



We use Yourkit 10.0.2, Spring 3 running on jetty 7. I suspect that this post highlights the same bug:
viewtopic.php?f=3&t=3882&p=13609&hilit=probe#p13595


regards Per Ehnbom
perehnbom
 
Posts: 2
Joined: Fri Nov 25, 2011 8:51 am

Re: Probe registers multiple method invocations

Postby perehnbom » Fri Nov 25, 2011 1:05 pm

Corrections:
the first method pattern should be:
Code: Select all
@MethodPattern({"mydomain.webapp.integration.*:*(*)"})


the last method pattern should be:
Code: Select all
@MethodPattern({"mydomain.webapp.integration.MyServiceFacade:getAccountDTOs(*)"})
perehnbom
 
Posts: 2
Joined: Fri Nov 25, 2011 8:51 am

Re: Probe registers multiple method invocations

Postby Anton Katilin » Mon Nov 28, 2011 3:24 pm

Hello Per

Maybe the probe is loaded twice from different locations.

What is the package of the probe class JspProbe?

Is it in mydomain.webapp.integration or in its sub-package?

How do you enable the probe?

Could you please specify startup option "debug=all" and provide the agent log. It should show which probes are applied.

I suspect that this post highlights the same bug:
viewtopic.php?f=3&t=3882&p=13609&hilit=probe#p13595

I think it is different issue.

Best regards,
Anton
Anton Katilin
 
Posts: 5709
Joined: Wed Aug 11, 2004 8:37 am


Return to Java Profiler

Who is online

Users browsing this forum: Google [Bot] and 17 guests

cron