|
14 | 14 | +----------------------------------------------------------------------+ |
15 | 15 | */ |
16 | 16 |
|
17 | | -/* $Id: 4d81858f42a199c1e7a68e13357dbe793da9e9e8 */ |
| 17 | +/* $Id: 59666fa435d463ccd47641c5bff7c4dd684c0bc6 */ |
18 | 18 |
|
19 | 19 | #ifndef SWOOLE_LIBRARY_H |
20 | 20 | #define SWOOLE_LIBRARY_H |
@@ -9570,28 +9570,37 @@ static const char* swoole_library_source_core_coroutine_functions = |
9570 | 9570 | "{\n" |
9571 | 9571 | " $all_coroutines = Coroutine::listCoroutines();\n" |
9572 | 9572 | " $count = Coroutine::stats()['coroutine_num'];\n" |
9573 | | - " echo \"\\n ===================================================================\",\n" |
| 9573 | + "\n" |
| 9574 | + " // coroutine deadlock detected, header\n" |
| 9575 | + " $hr_width = 64 + strlen(strval($count));\n" |
| 9576 | + " $hr1 = str_repeat('=', $hr_width);\n" |
| 9577 | + " $hr2 = str_repeat('-', $hr_width);\n" |
| 9578 | + " echo '',\n" |
| 9579 | + " \"\\n {$hr1}\",\n" |
9574 | 9580 | " \"\\n [FATAL ERROR]: all coroutines (count: {$count}) are asleep - deadlock!\",\n" |
9575 | | - " \"\\n ===================================================================\",\n" |
9576 | | - " \"\\n \";\n" |
| 9581 | + " \"\\n {$hr1}\",\n" |
| 9582 | + " \"\\n\";\n" |
9577 | 9583 | "\n" |
| 9584 | + " // print all coroutine backtraces\n" |
9578 | 9585 | " $options = Coroutine::getOptions();\n" |
9579 | 9586 | " if (empty($options['deadlock_check_disable_trace'])) {\n" |
9580 | 9587 | " $index = 0;\n" |
9581 | 9588 | " $limit = empty($options['deadlock_check_limit']) ? 32 : intval($options['deadlock_check_limit']);\n" |
9582 | 9589 | " $depth = empty($options['deadlock_check_depth']) ? 32 : intval($options['deadlock_check_depth']);\n" |
9583 | 9590 | " foreach ($all_coroutines as $cid) {\n" |
9584 | | - " echo \"\\n [Coroutine-{$cid}]\";\n" |
9585 | | - " echo \"\\n --------------------------------------------------------------------\\n\";\n" |
| 9591 | + " echo \"\\n [Coroutine-{$cid}]\";\n" |
| 9592 | + " echo \"\\n {$hr2}\\n\";\n" |
9586 | 9593 | " echo Coroutine::printBackTrace($cid, DEBUG_BACKTRACE_IGNORE_ARGS, $depth);\n" |
9587 | | - " echo \"\\n \";\n" |
9588 | 9594 | " $index++;\n" |
9589 | 9595 | " // limit the number of maximum outputs\n" |
9590 | 9596 | " if ($index >= $limit) {\n" |
9591 | 9597 | " break;\n" |
9592 | 9598 | " }\n" |
9593 | 9599 | " }\n" |
9594 | 9600 | " }\n" |
| 9601 | + "\n" |
| 9602 | + " // footer\n" |
| 9603 | + " echo \"\\n {$hr1}\\n\";\n" |
9595 | 9604 | "}\n"; |
9596 | 9605 |
|
9597 | 9606 | static const char* swoole_library_source_ext_curl = |
|
0 commit comments