Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BTRACE-107] Kind.CALL event missed #70

Closed
jbachorik opened this issue Aug 28, 2014 · 2 comments
Closed

[BTRACE-107] Kind.CALL event missed #70

jbachorik opened this issue Aug 28, 2014 · 2 comments

Comments

@jbachorik
Copy link
Collaborator

[reporter="duanetiemann", created="Tue, 25 Mar 2014 14:22:59 +0100"]

The following program fails to record the call to LinkedList.offer from readDataFromOpenFile. The output shows that readDataFromOpenFile is called and the probe that directly monitors LinkedList.offer when called from readDataFromOpenFile does fire and the jstackStr shows that it is called directly from readDataFromOpenFile. The probe with Kind.CALL is missed. Hopefully this is a horrible error on my part, but I don't see it.

importcom.sun.btrace.annotations.*;
importcom.sun.btrace.AnyType;
import static com.sun.btrace.BTraceUtils.*;

@btrace
public class ProblemDemo
{
static int Count=0;
static int MaxCount=500;
@tls static boolean InreadDataFromOpenFile = false;

@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",location=@location(Kind.ENTRY))
public static void readDataFromOpenFileEntry(AnyType[] args)

{
InreadDataFromOpenFile = true;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile Entry"))));
if (Count++ > MaxCount)exit();
}

@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",location=@location(Kind.RETURN))
public static void readDataFromOpenFileReturn()

{
InreadDataFromOpenFile = false;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile Return"))));
if (Count++ > MaxCount)exit();
}

@OnMethod(clazz="java.util.LinkedList", method="offer", location=@location(Kind.ENTRY))
public static void LinkedListofferEntry()

{
if (!InreadDataFromOpenFile)return;
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
strcat(" LinkedList.offer Entry" ,
strcat(" stack=" ,
jstackStr()))))));

if (Count++ > MaxCount)exit();
}

@OnMethod(clazz="com.emc.storageos.data.object.controller.impl.FileSystemDeviceController", method="readDataFromOpenFile",
location=@location(value=Kind.CALL,clazz="java.util.LinkedList",method="offer"))
public static void readDataFromOpenFilecallsLinkedListofferEntry()

{
println(strcat(str(threadId(currentThread())) ,
strcat(timestamp(" yyyy/MM/dd HH:mm:ss.SSS ") ,
strcat(str(timeNanos()) ,
" readDataFromOpenFile_calls_LinkedList.offer Entry"))));
if (Count++ > MaxCount)exit();
}

}

@jbachorik
Copy link
Collaborator Author

[author="j.bachorik", created="Wed, 30 Jul 2014 19:16:17 +0200"]

My take on this would be that you are calling the offer method on java.util.Deque interface as opposed to calling it directly on java.util.LinkedList implementation class. And therefore it is not matched as the handler expects java.util.LinkedList.

You would have to provide an exact type the method is called on. The @Location.clazz might be extended to understand the +" notation and match all subclasses and implementations but it would increase the time needed for processing the classes because a lot of classes would have to be retransformed right after they were initialized to make sure the supertypes/interfaces were loaded and initialized. I am not sure whether it is worth it.

@github-actions
Copy link

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant