Warning: Undefined array key "custom_message" in /www/wwwroot/bbs.aaronyang.cc/wp-content/plugins/wpcopyrights/index.php on line 105

pstack

pstack

显示每个进程的栈跟踪

补充说明

pstack命令 可显示每个进程的栈跟踪。pstack 命令必须由相应进程的属主或 root 运行。可以使用 pstack 来确定进程挂起的位置。此命令允许使用的唯一选项是要检查的进程的 PID

命令软件包下载地址:https://packages.debian.org/sid/pstack

实例

pstree以树结构显示进程

pstree -p work | grep ad
sshd(22669)---bash(22670)---ad_preprocess(4551)-+-{ad_preprocess}(4552)
                                                |-{ad_preprocess}(4553)
                                                |-{ad_preprocess}(4554)
                                                |-{ad_preprocess}(4555)
                                                |-{ad_preprocess}(4556)
                                                `-{ad_preprocess}(4557)

work为工作用户,-p为显示进程识别码,ad_preprocess共启动了6个子线程,加上主线程共7个线程。

ps -Lf 4551
UID        PID  PPID   LWP  C NLWP STIME TTY      stat   time CMD
work      4551 22670  4551  2    7 16:30 pts/2    Sl+    0:02 ./ad_preprocess
work      4551 22670  4552  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4553  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4554  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4555  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4556  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
work      4551 22670  4557  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess

进程共启动了7个线程

pstack显示每个进程的栈跟踪:

pstack 4551
Thread 7 (Thread 1084229984 (LWP 4552)):
#0  0x000000302afc63dc in epoll_wait () from /lib64/tls/libc.so.6
#1  0x00000000006f0730 in ub::EPollEx::poll ()
#2  0x00000000006f172a in ub::NetReactor::callback ()
#3  0x00000000006fbbbb in ub::UBTask::CALLBACK ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
Thread 6 (Thread 1094719840 (LWP 4553)):
#0  0x000000302afc63dc in epoll_wait () from /lib64/tls/libc.so.6
#1  0x00000000006f0730 in ub::EPollEx::poll ()
#2  0x00000000006f172a in ub::NetReactor::callback ()
#3  0x00000000006fbbbb in ub::UBTask::CALLBACK ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
Thread 5 (Thread 1105209696 (LWP 4554)):
#0  0x000000302b80baa5 in __nanosleep_nocancel ()
#1  0x000000000079e758 in comcm::ms_sleep ()
#2  0x00000000006c8581 in ub::UbClientManager::healthyCheck ()
#3  0x00000000006c8471 in ub::UbClientManager::start_healthy_check ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
Thread 4 (Thread 1115699552 (LWP 4555)):
#0  0x000000302b80baa5 in __nanosleep_nocancel ()
#1  0x0000000000482b0e in armor::armor_check_thread ()
#2  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#3  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#4  0x0000000000000000 in ?? ()
Thread 3 (Thread 1126189408 (LWP 4556)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x000000000044c972 in Business_config_manager::run ()
#3  0x0000000000457b83 in Thread::run_thread ()
#4  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#5  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#6  0x0000000000000000 in ?? ()
Thread 2 (Thread 1136679264 (LWP 4557)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x00000000004524bb in Process_thread::sleep_period ()
#3  0x0000000000452641 in Process_thread::run ()
#4  0x0000000000457b83 in Thread::run_thread ()
#5  0x000000302b80610a in start_thread () from /lib64/tls/libpthread.so.0
#6  0x000000302afc6003 in clone () from /lib64/tls/libc.so.6
#7  0x0000000000000000 in ?? ()
Thread 1 (Thread 182894129792 (LWP 4551)):
#0  0x000000302af8f1a5 in __nanosleep_nocancel () from /lib64/tls/libc.so.6
#1  0x000000302af8f010 in sleep () from /lib64/tls/libc.so.6
#2  0x0000000000420d79 in Ad_preprocess::run ()
#3  0x0000000000450ad0 in main ()

若文章对你有帮助,可以点赞或打赏支持我们。发布者:Aurora,转载请注明出处:http://61.174.243.28:13541/AY-knowledg-hub/pstack/

(0)
AuroraAurora站点维系者
上一篇 2024年 3月 1日 下午4:39
下一篇 2024年 3月 1日 下午4:39

相关推荐

  • pmap

    文章目录pmap补充说明语法选项参数实例 pmap 报告进程的内存映射关系 补充说明 pmap命令 用于报告进程的内存映射关系,是Linux调试及运维一个很好的工具。 语法 pma…

    入门教程 2024年 3月 1日
  • lastlog

    文章目录lastlog补充说明语法选项实例 lastlog 显示系统中所有用户最近一次登录信息 补充说明 lastlog命令 用于显示系统中所有用户最近一次登录信息。 lastlo…

    入门教程 2023年 12月 19日
  • md5sum

    文章目录md5sum补充说明语法选项参数实例 md5sum 计算和校验文件报文摘要的工具程序 补充说明 md5sum命令 采用MD5报文摘要算法(128位)计算和检查文件的校验和。…

    入门教程 2024年 1月 3日
  • elinks

    文章目录elinks补充说明语法选项参数 elinks 纯文本界面的WWW浏览器 补充说明 elinks命令 能实现一个纯文本界面的WWW浏览器,操作方式与“lynx”类似。 语法…

    入门教程 2023年 12月 14日
  • pssh

    文章目录pssh补充说明安装pssh选项实例 pssh 批量管理执行 补充说明 pssh命令 是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中…

    入门教程 2024年 3月 1日
  • cupsenable

    文章目录cupsenable补充说明语法选项参数 cupsenable 启动指定的打印机 补充说明 cupsenable命令 用于启动指定的打印机。 语法 cupsenable(选…

    入门教程 2023年 12月 7日
  • squid

    文章目录squid补充说明语法选项 squid squid服务器守护进程 补充说明 squid命令 高性能的Web客户端代理缓存服务器套件“squid”的服务器守护进程。 语法 s…

    入门教程 2024年 3月 5日
  • ftpwho

    文章目录ftpwho补充说明语法选项 ftpwho 显示当前每个ftp会话信息 补充说明 ftpwho命令 ftp服务器套件proftpd的工作指令,用于显示当前每个ftp会话信息…

    入门教程 2023年 12月 14日
  • Helm | Helm 删除仓库

    文章目录helm repo remove可选项从父命令继承的命令请参阅 helm repo remove 删除一个或多个仓库 helm repo remove [REPO1 [RE…

    入门教程 2023年 12月 14日
  • Java StringBuffer 和 StringBuilder 类

    当对字符串进行修改的时候,需要使用 StringBuffer 和 StringBuilder 类。 和 String 类不同的是,StringBuffer 和 StringBuil…

    2023年 3月 4日

发表回复

登录后才能评论
Translate »