我一直在解决一个JVM似乎挂起的Linux相当困难的问题。 作为调查的一部分,我一直在尝试使用“magic”sysrq命令之一来捕获当前任务及其状态的列表:
echo t> / proc / sysrq-trigger
令人惊讶的是,如果我在一个健康的系统上这样做,我会得到所有进程,状态和当前调用堆栈的完整列表。 当我用一个“不健康的”系统(也就是JVM以某种方式挂起的系统)执行这个操作时,某些进程就会丢失。 例如,我的multithreadingJava应用程序的父进程没有被报告。 这使得我们很难得出任何结论,因为我无法准确了解发生了什么。
任何人都知道是否有条件可以排除该报告的stream程?
谢谢!
JVM挂起是因为它试图写入一个不存在的进程? 从linux-source-2.6.38代码看,sysrq触发器只是调用:
/linux-source-2.6.38/include/linux/sched.h 283 /* 284 * Only dump TASK_* tasks. (0 for all tasks) 285 */ 286 extern void show_state_filter(unsigned long state_filter); 287 288 static inline void show_state(void) 289 { 290 show_state_filter(0); 291 }
哪些电话:
/linux-source-2.6.38/kernel/sched.c 5485 void show_state_filter(unsigned long state_filter) 5486 { 5487 struct task_struct *g, *p; 5488 5489 #if BITS_PER_LONG == 32 5490 printk(KERN_INFO 5491 " task PC stack pid father\n"); 5492 #else 5493 printk(KERN_INFO 5494 " task PC stack pid father\n"); 5495 #endif 5496 read_lock(&tasklist_lock); 5497 do_each_thread(g, p) { 5498 /* 5499 * reset the NMI-timeout, listing all files on a slow 5500 * console might take alot of time: 5501 */ 5502 touch_nmi_watchdog(); 5503 if (!state_filter || (p->state & state_filter)) 5504 sched_show_task(p); 5505 } while_each_thread(g, p); 5506 5507 touch_all_softlockup_watchdogs(); 5508 5509 #ifdef CONFIG_SCHED_DEBUG 5510 sysrq_sched_debug_show(); 5511 #endif 5512 read_unlock(&tasklist_lock); 5513 /* 5514 * Only show locks if all tasks are dumped: 5515 */ 5516 if (!state_filter) 5517 debug_show_all_locks(); 5518 }
那里没有任何filter,所以它的打印build议父母的一切都消失了。 你运行lsof或ps并validation它仍在运行?