Description of problem: When pythonflow output traces, TypeError happens. Version-Release number of selected component (if applicable): bcc-0.6.1-2.fc28.x86_64 bcc-doc-0.6.1-2.fc28.noarch python3-bcc-0.6.1-2.fc28.x86_64 bcc-lua-0.6.1-2.fc28.x86_64 bcc-tools-0.6.1-2.fc28.x86_64 How reproducible: Always Steps to Reproduce: 1. $ python 2. $ sudo /usr/share/bcc/tools/pythonflow <PID> 3. type Enter in python REPL Actual results: $ sudo ./pythonflow -C '<stdin>' 26904 Tracing method calls in python process 26904... Ctrl-C to quit. CPU PID TID TIME(us) METHOD Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' File "/usr/lib/python3.6/site-packages/bcc/table.py", line 572, in raw_cb_ callback(cpu, data, size) File "./lib/uflow", line 187, in print_event (" " * (depth - 1)) + direction + event.clazz + "." + event.method)) TypeError: must be str, not bytes (and this traceback repeats) Expected results: $ sudo ./pythonflow -C '<stdin>' 27058 Tracing method calls in python process 27058... Ctrl-C to quit. CPU PID TID TIME(us) METHOD 3 27058 27058 3.246 -> b'<stdin>'.b'<module>' 3 27058 27058 3.246 -> b'<stdin>'.b'<module>' Additional info: In lib/uflow's print_event function, event.clazz and event.method are bytes. Putting str() for casting works. print("%-3d %-6d %-6d %-8.3f %-40s" % (cpu, event.pid >> 32, event.pid & 0xFFFFFFFF, time.time() - start_ts, (" " * (depth - 1)) + direction + str(event.clazz) + "." + str(event.method))) ctypes.cast maps char * into bytes in python3. I expect this problem was caused by Python 2/3 difference, and some other tools have similar problems.
Does it still happen with bcc-0.7.0?
Yes, I reproduced with bcc-0.7.0-1 package. rpm -qa|grep bcc bcc-tools-0.7.0-1.fc28.x86_64 bcc-0.7.0-1.fc28.x86_64 python3-bcc-0.7.0-1.fc28.x86_64 # ./pythonflow 8887 Tracing method calls in python process 8887... Ctrl-C to quit. CPU PID TID TIME(us) METHOD Traceback (most recent call last): File "_ctypes/callbacks.c", line 234, in 'calling callback function' File "/usr/lib/python3.6/site-packages/bcc/table.py", line 572, in raw_cb_ callback(cpu, data, size) File "./lib/uflow", line 194, in print_event (" " * (depth - 1)) + direction + event.clazz + "." + event.method)) TypeError: must be str, not bytes
Thank you. I reported it upstream https://github.com/iovisor/bcc/issues/1996.
A patch was merged upstream. I'm going to submit new builds with the fix.
bcc-0.7.0-2.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-dbf899e111
bcc-0.7.0-2.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-a7443c7234
bcc-0.7.0-2.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-dbf899e111
bcc-0.7.0-2.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-a7443c7234
Thank you for your super-fast fixing! I verified the new package works.
bcc-0.7.0-2.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
bcc-0.7.0-2.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.