Dump stack trace of the main thread and process tree info
()
| 108 | |
| 109 | |
| 110 | def dump_thread_stacks() -> None: |
| 111 | """Dump stack trace of the main thread and process tree info""" |
| 112 | print("\n=== MAIN THREAD STACK TRACE ===") |
| 113 | for thread in threading.enumerate(): |
| 114 | print(f"\nThread {thread.name}:") |
| 115 | if thread.ident is not None: |
| 116 | frame = sys._current_frames().get(thread.ident) |
| 117 | if frame: |
| 118 | traceback.print_stack(frame) |
| 119 | print("=== END STACK TRACE ===\n") |
| 120 | |
| 121 | # Dump process tree information |
| 122 | print("\n=== PROCESS TREE INFO ===") |
| 123 | print(get_process_tree_info(os.getpid())) |
| 124 | print("=== END PROCESS TREE INFO ===\n") |
| 125 | |
| 126 | |
| 127 | def setup_watchdog(timeout: int = 60) -> threading.Thread: |
no test coverage detected