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

The Java wrapper is unable to collect data from Java_sun_nio_ch_IOUtil_makePipe #842

Closed
qsLI opened this issue Nov 14, 2023 · 2 comments
Closed

Comments

@qsLI
Copy link

qsLI commented Nov 14, 2023

I used a Java wrapper to collect data from Java_sun_nio_ch_IOUtil_makePipe, but it didn't work. However, using profiler.sh, I was able to collect the data, even though they use the same library.

async profiler version 2.8

Java Wrapper

The complete command executed using the Java wrapper is:
start,event=Java_sun_nio_ch_IOUtil_makePipe,cstack=fp,interval=10ms,file=/tmp/profile1699956077050.jfr

The settings in the collected JFR file also indicate that the command is correct:
image

`jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "version"
value = "2.8"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "ring"
value = N/A
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "cstack"
value = "fp"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "event"
value = "Java_sun_nio_ch_IOUtil_makePipe"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "filter"
value = N/A
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "begin"
value = N/A
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "end"
value = N/A
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "jstackdepth"
value = "2048"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "safemode"
value = "0"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "jfropts"
value = "0"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "chunksize"
value = "104857600"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "chunktime"
value = "3600"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 101
name = "enabled"
value = "true"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 101
name = "interval"
value = "10000000"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 102
name = "enabled"
value = "false"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 103
name = "enabled"
value = "false"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 104
name = "enabled"
value = "false"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 105
name = "enabled"
value = "false"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "debugSymbols"
value = "true"
eventThread = "profiler-executor" (javaThreadId = 2343)
}

jdk.ActiveSetting {
startTime = 2023-11-14T08:12:31.023202Z
id = 107
name = "kernelSymbols"
value = "true"
eventThread = "profiler-executor" (javaThreadId = 2343)
}`

profiler.sh

The command used to collect data using profiler.sh is as follows:

./profiler.sh -d 60 -e Java_sun_nio_ch_IOUtil_makePipe --cstack fp --jfrsync default -f p.jfr 58

settings:
`
jdk.ActiveSetting {
startTime = 2023-11-14T09:13:54.688909Z
id = 107
name = "version"
value = "2.8"
eventThread = "Attach Listener" (javaThreadId = 154)
}

jdk.ActiveSetting {
startTime = 2023-11-14T09:13:54.688909Z
id = 107
name = "ring"
value = N/A
eventThread = "Attach Listener" (javaThreadId = 154)
}

jdk.ActiveSetting {
startTime = 2023-11-14T09:13:54.688909Z
id = 107
name = "cstack"
value = "fp"
eventThread = "Attach Listener" (javaThreadId = 154)
}

jdk.ActiveSetting {
startTime = 2023-11-14T09:13:54.688909Z
id = 107
name = "event"
value = "Java_sun_nio_ch_IOUtil_makePipe"
eventThread = "Attach Listener" (javaThreadId = 154)
}
`

result:
`jdk.ExecutionSample {
startTime = 2023-11-14T09:13:56.264258508Z
sampledThread = "kafka-lag-scan-2051" (javaThreadId = 13258)
state = "STATE_RUNNABLE"
stackTrace = [
libnio.so.Java_sun_nio_ch_IOUtil_makePipe() line: 0
sun.nio.ch.IOUtil.makePipe(boolean) line: 0
sun.nio.ch.EPollSelectorImpl.(SelectorProvider) line: 83
sun.nio.ch.EPollSelectorProvider.openSelector() line: 36
java.nio.channels.Selector.open() line: 295
...
]
}

jdk.ExecutionSample {
startTime = 2023-11-14T09:13:56.432912837Z
sampledThread = "kafka-lag-scan-2051" (javaThreadId = 13258)
state = "STATE_RUNNABLE"
stackTrace = [
libnio.so.Java_sun_nio_ch_IOUtil_makePipe() line: 0
sun.nio.ch.IOUtil.makePipe(boolean) line: 0
sun.nio.ch.EPollSelectorImpl.(SelectorProvider) line: 83
sun.nio.ch.EPollSelectorProvider.openSelector() line: 36
java.nio.channels.Selector.open() line: 295
...
]
}`

@apangin
Copy link
Collaborator

apangin commented Nov 20, 2023

Remove interval argument.

event=function_name enables tracing profiler. If you want to capture every single function call, do not set interval at all or set it to 1. Otherwise, profiler will work in sampling mode to capture every Nth call.

@qsLI
Copy link
Author

qsLI commented Nov 22, 2023

Thanks for your reply,I'll give it a try.

@apangin apangin closed this as completed Nov 24, 2023
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

2 participants