Linux工具 - PSTACK跟踪进程栈

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

  • 2016年云计算热词
    Posted on 2019-06-12 17:53
  • 能创建多少个 TCP 连接?
    Posted on 2021-08-02 16:00
  • MySQL中的行级锁,表级锁,页级锁
    Posted on 2018-08-25 11:00
  • 投票通过,PHP 8 确认引入 Union Types 2.0
    Posted on 2019-11-18 22:22
  • PHP没你想的那么差
    Posted on 2021-12-17 15:40
  • 通过信鸽来解释HTTPS
    Posted on 2018-10-22 13:56
  • PHP练习-移动数组内的0到最后并保持其他元素顺序不变
    Posted on 2020-08-14 20:32
  • 快速了解Kafka
    Posted on 2021-03-25 14:20