Linux工具 - PSTACK跟踪进程栈

2019-04-23 11:59 By "Powerless" 2889 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 2019-11-18 16:30
  • PHP设计模式 - 委托模式
    Posted on 2019-04-25 16:15
  • 初识七层、五层、四层网络协议
    Posted on 2021-04-09 16:52
  • PHP7不兼容性
    Posted on 2018-03-07 15:59
  • 浏览器访问网站经历的步骤-Html
    Posted on 2018-11-28 18:48
  • PHP练习-无重复字符的最长子串
    Posted on 2020-09-17 18:03
  • QPS、TPS、RT、吞吐量到底是什么
    Posted on 2020-02-02 01:15
  • ACID原则
    Posted on 2020-12-17 16:36