Linux工具 - PSTACK跟踪进程栈

2019-04-23 11:59 By "Powerless" 2878 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

  • Redis各种数据类型的使用场景举例分析【三】
    Posted on 2018-11-22 17:00
  • 投票通过,PHP 8 确认引入 Union Types 2.0
    Posted on 2019-11-18 22:22
  • PHP设计模式 - 委托模式
    Posted on 2019-04-25 16:15
  • BASE原则
    Posted on 2020-12-17 16:42
  • PHP扩展安装
    Posted on 2019-06-24 11:28
  • 程序员年中考试题-段子版
    Posted on 2021-06-23 15:57
  • 一些常见的基础概念
    Posted on 2018-11-28 19:10
  • HTTP和HTTPS的区别
    Posted on 2020-08-10 23:00