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

profiler 的 duration 参数不生效 #2888

Open
1 task done
kong62 opened this issue Aug 27, 2024 · 5 comments
Open
1 task done

profiler 的 duration 参数不生效 #2888

kong62 opened this issue Aug 27, 2024 · 5 comments

Comments

@kong62
Copy link

kong62 commented Aug 27, 2024

  • 我已经在 issues 里搜索,没有重复的issue。

环境信息

  • arthas-boot.jar 或者 as.sh 的版本: 4.0.0、3.72.、3.6.2
  • Arthas 版本: 4.0.0、3.72.、3.6.2
  • 操作系统版本: CentOS Linux release 7.9.2009 (Core)
  • 目标进程的JVM版本: openjdk version "11.0.23" 2024-04-16
  • 执行arthas-boot的版本: 4.0.0、3.72.、3.6.2

重现问题的步骤

  1. 附加到进程
# ./as.sh 6530
  1. 开始剖析
[arthas@6530]$ profiler start -f /data0/log-data/JvmFlameGraphFile.html -d 30 --event cpu
Profiling started
  1. 查看状态
[arthas@6530]$ profiler status 
Profiling is running for 6 seconds
[arthas@6530]$ profiler status 
Profiling is running for 7 seconds
[arthas@6530]$ profiler status 
Profiling is running for 8 seconds
[arthas@6530]$ profiler status 
Profiling is running for 9 seconds
[arthas@6530]$ profiler status 
Profiling is running for 10 seconds
[arthas@6530]$ profiler status 
Profiling is running for 11 seconds
[arthas@6530]$ profiler status 
Profiling is running for 13 seconds
[arthas@6530]$ profiler status 
Profiling is running for 14 seconds
[arthas@6530]$ profiler status 
Profiling is running for 16 seconds
[arthas@6530]$ profiler status 
Profiling is running for 17 seconds
[arthas@6530]$ profiler status 
Profiling is running for 19 seconds
[arthas@6530]$ profiler status 
Profiling is running for 20 seconds
[arthas@6530]$ profiler status 
Profiling is running for 21 seconds
[arthas@6530]$ profiler status 
Profiling is running for 22 seconds
[arthas@6530]$ profiler status 
Profiling is running for 23 seconds
[arthas@6530]$ profiler status 
Profiling is running for 25 seconds
[arthas@6530]$ profiler status 
Profiling is running for 26 seconds
[arthas@6530]$ profiler status 
Profiling is running for 27 seconds
[arthas@6530]$ profiler status 
Profiling is running for 27 seconds
[arthas@6530]$ profiler status 
Profiling is running for 28 seconds
[arthas@6530]$ profiler status 
Profiling is running for 29 seconds
[arthas@6530]$ profiler status 
Profiling is running for 30 seconds
[arthas@6530]$ profiler status 
Profiling is running for 31 seconds
[arthas@6530]$ profiler status 
Profiling is running for 31 seconds
[arthas@6530]$ profiler status 
Profiling is running for 32 seconds
[arthas@6530]$ profiler status 
Profiling is running for 33 seconds
[arthas@6530]$ profiler status 
Profiling is running for 34 seconds
[arthas@6530]$ profiler status 
Profiling is running for 35 seconds
[arthas@6530]$ profiler status 
Profiling is running for 36 seconds
[arthas@6530]$ profiler status 
Profiling is running for 36 seconds
[arthas@6530]$ profiler status 
Profiling is running for 38 seconds
[arthas@6530]$ profiler status 
Profiling is running for 39 seconds
[arthas@6530]$ profiler status 
Profiling is running for 40 seconds
[arthas@6530]$ profiler status 
Profiling is running for 68 seconds
...

期望的结果

运行 30 秒后,自动停止并输出火焰图

@RaymondLam1
Copy link
Collaborator

参考:链接

@RaymondLam1
Copy link
Collaborator

RaymondLam1 commented Sep 2, 2024

实际测试发现 --timeout 和 --loop 选项,在 3.7 版本中运行不符合预期,在 4.0 不能正常运行:

[INFO] arthas home: /Users/raymond/arthas/arthas-bin
[INFO] Try to attach process 17282
Picked up JAVA_TOOL_OPTIONS:
[INFO] Attach process 17282 success.
[INFO] arthas-client connect 127.0.0.1 3658
  ,---.  ,------. ,--------.,--.  ,--.  ,---.   ,---.
 /  O  \ |  .--. ''--.  .--'|  '--'  | /  O  \ '   .-'
|  .-.  ||  '--'.'   |  |   |  .--.  ||  .-.  |`.  `-.
|  | |  ||  |\  \    |  |   |  |  |  ||  | |  |.-'    |
`--' `--'`--' '--'   `--'   `--'  `--'`--' `--'`-----'

wiki       https://arthas.aliyun.com/doc
tutorials  https://arthas.aliyun.com/doc/arthas-tutorials.html
version    4.0.0
main_class com.example.demo.DemoApplication
pid        17282
time       2024-09-02 11:14:27.976

[arthas@17282]$ profiler start --timeout 3h
AsyncProfiler error: Invalid timeout

可能是 async-profiler 版本变化导致的

@RaymondLam1
Copy link
Collaborator

RaymondLam1 commented Sep 2, 2024

#2868 也是 profiler 相关的配置参数问题。

@furaul
Copy link
Contributor

furaul commented Sep 2, 2024

image
image

start命令里面并未用到duration参数,看源码,duration只对collect命令生效。

@furaul
Copy link
Contributor

furaul commented Sep 2, 2024

在start里指定结束时间,可以使用timeout参数

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

No branches or pull requests

3 participants