From 65297fede98499ff59b847a8119146817a36a9cb Mon Sep 17 00:00:00 2001 From: He Zhe Date: Fri, 14 Aug 2020 03:12:32 +0000 Subject: bcc: trace: Fix failing to exit loops /usr/share/bcc/tools/trace do_sys_open -M 1 PID TID COMM FUNC 3740 3740 irqbalance do_sys_open Exception ignored on calling ctypes callback function: .raw_cb at 0x7f7c9efea280> Traceback (most recent call last): File "/usr/lib64/python3.8/site-packages/bcc/table.py", line 685, in raw_cb_ callback(cpu, data, size) File "/usr/share/bcc/tools/trace", line 630, in print_event exit() File "/usr/lib64/python3.8/sitebuiltins.py", line 26, in __call_ raise SystemExit(code) SystemExit: None Class Probe::print_event is used as a callback of a ctypes wrapper. With Yocto latest python v3.8.5, the exception raised by exit() is ignored and thus trace cannot exit. Use os._exit(0) instead. Signed-off-by: He Zhe --- .../0001-tools-trace.py-Fix-failing-to-exit.patch | 46 ++++++++++++++++++++++ .../recipes-devtools/bcc/bcc_0.15.0.bb | 1 + 2 files changed, 47 insertions(+) create mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch new file mode 100644 index 0000000..e39e21f --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-trace.py-Fix-failing-to-exit.patch @@ -0,0 +1,46 @@ +From a9f59fc8605de1bcca0b6c2d8132585f40c3b9bc Mon Sep 17 00:00:00 2001 +From: He Zhe +Date: Thu, 13 Aug 2020 11:25:58 +0800 +Subject: [PATCH] tools/trace.py: Fix failing to exit + +Class Probe::print_event is used as a callback of a ctypes wrapper. With +Yocto latest python v3.8.5, the exception raised by exit() is ignored and +thus trace cannot exit. Use os._exit(0) instead. + +$ /usr/share/bcc/tools/trace do_sys_open -M 1 +PID TID COMM FUNC +3740 3740 irqbalance do_sys_open +Exception ignored on calling ctypes callback function: +.raw_cb at 0x7f7c9efea280> +Traceback (most recent call last): +File "/usr/lib64/python3.8/site-packages/bcc/table.py", line 685, in raw_cb_ +callback(cpu, data, size) +File "/usr/share/bcc/tools/trace", line 630, in print_event +exit() +File "/usr/lib64/python3.8/sitebuiltins.py", line 26, in __call_ +raise SystemExit(code) +SystemExit: None + +Upstream-Status: Pending + +Signed-off-by: He Zhe +--- + tools/trace.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/trace.py b/tools/trace.py +index 7a61594f..d09dd2a8 100755 +--- a/tools/trace.py ++++ b/tools/trace.py +@@ -627,7 +627,7 @@ BPF_PERF_OUTPUT(%s); + Probe.event_count += 1 + if Probe.max_events is not None and \ + Probe.event_count >= Probe.max_events: +- exit() ++ os._exit(0) + sys.stdout.flush() + + def attach(self, bpf, verbose): +-- +2.17.1 + diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.15.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.15.0.bb index 0e55384..a9ae91e 100644 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.15.0.bb +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.15.0.bb @@ -18,6 +18,7 @@ SRC_URI = "gitsm://github.com/iovisor/bcc \ file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \ file://0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch \ file://0001-Replace-kprobe-function-blk_account_io_completion-to.patch \ + file://0001-tools-trace.py-Fix-failing-to-exit.patch \ " SRCREV = "e41f7a3be5c8114ef6a0990e50c2fbabea0e928e" -- cgit v1.2.3-54-g00ecf