Linux工具 - PSTACK跟踪进程栈

2019-04-23 11:59 By "Powerless" 2888 0 2

    这个命令在排查进程问题时非常有用,比如我们发现一个服务一直处于工作状态(如假死状态,好似死循环),使用这个命令就能轻松定位问题所在;可以在一段时间内,多执行几次的pstack ,若发现代码栈总是停在同一个位置,那个位置就需要重点关注,很可能就是出问题的地方;


示例:查看bash的程序进程栈:

[root@wzxaini9 ~]# ps -fe| grep bash
root      6548 32623  0 12:01 pts/0    00:00:00 grep --color=auto bash
root     32623 32610  0 10:44 pts/0    00:00:00 -bash
[root@wzxaini9 ~]# pstack 32623
#0  0x00007fe82bbd8a3c in waitpid () from /usr/lib64/libc.so.6
#1  0x0000000000440a74 in waitchld.isra.10 ()
#2  0x0000000000441d2c in wait_for ()
#3  0x00000000004339fe in execute_command_internal ()
#4  0x0000000000433c1e in execute_command ()
#5  0x000000000041e255 in reader_loop ()
#6  0x000000000041c8be in main ()


评 论

View in WeChat

Others Discussion

  • 一些常见的基础概念
    Posted on 2018-11-28 19:10
  • MySQL事务介绍
    Posted on 2019-06-05 18:14
  • 程序员年中考试题-段子版
    Posted on 2021-06-23 15:57
  • BASE原则
    Posted on 2020-12-17 16:42
  • 2018年云计算热词
    Posted on 2019-06-12 18:19
  • PHP8.1 性能基准测试
    Posted on 2022-10-08 17:40
  • Mysql联合索引的最左前缀匹配原则
    Posted on 2018-08-25 15:00
  • HTTP和HTTPS的区别
    Posted on 2020-08-10 23:00