Linux工具 - PSTACK跟踪进程栈

2019-04-23 11:59 By "Powerless" 2770 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 2020-02-07 18:57
  • 有状态服务VS无状态服务
    Posted on 2020-02-07 18:18
  • 企业级PAAS云平台几个关键问题和挑战
    Posted on 2019-06-12 18:33
  • MySQL 单库后期分库策略
    Posted on 2019-08-19 14:31
  • Redis七大经典问题
    Posted on 2021-05-27 11:14
  • 关于HTTPS的五大误区
    Posted on 2020-02-02 01:10
  • PHP实现精确发布时间
    Posted on 2018-12-06 21:00
  • 为什么要测量尾部延迟
    Posted on 2020-09-18 10:34

1.185847s