Comments (6)
Can you provide a minimum reproducing example so I can take a look at it?
from viztracer.
The root cause is my monkey patch to subprocess.Popen
when shell=True
. I fixed it in #434 and it will be out in the next release. In the mean time, if you need the feature immediately, feel free to install from the github source directly.
from viztracer.
Ok here you go. Looks like it has to do with subprocessing out to python as well. (Using an echo command doesn't have the same issue.) Viztracer version is 0.16.3
. Python is 3.12.3
on Arch Linux.
In subpython.py
:
print("hello viztracer")
In viztracer_asyncio_subprocess.py
:
import asyncio
async def run_echo():
process = await asyncio.create_subprocess_shell(
"python subpython.py",
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE)
stdout, stderr = await process.communicate()
print(stdout)
asyncio.run(run_echo())
Run python viztracer_asyncio_subprocess.py
and get:
b'hello viztracer\n'
Run viztracer viztracer_asyncio_subprocess.py
and it hangs. ctrl-c gives:
Total Entries: 1145
Use the following command to open the report:
vizviewer /home/tannewt/repos/circuitpython/ports/raspberrypi/result.json
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/tannewt/repos/circuitpython/ports/raspberrypi/viztracer_asyncio_subprocess.py", line 8, in run_echo
stdout, stderr = await process.communicate()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/subprocess.py", line 201, in communicate
stdin, stdout, stderr = await tasks.gather(stdin, stdout, stderr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/subprocess.py", line 181, in _read_stream
output = await stream.read()
^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/streams.py", line 706, in read
block = await self.read(self._limit)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/streams.py", line 713, in read
await self._wait_for_data('read')
File "/usr/lib/python3.12/asyncio/streams.py", line 545, in _wait_for_data
await self._waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/tannewt/repos/venv/bin/viztracer", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/tannewt/repos/venv/lib/python3.12/site-packages/viztracer/main.py", line 671, in main
success, err_msg = ui.run()
^^^^^^^^
File "/home/tannewt/repos/venv/lib/python3.12/site-packages/viztracer/main.py", line 317, in run
return self.run_command()
^^^^^^^^^^^^^^^^^^
File "/home/tannewt/repos/venv/lib/python3.12/site-packages/viztracer/main.py", line 449, in run_command
return self.run_code(code, main_mod.__dict__)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/tannewt/repos/venv/lib/python3.12/site-packages/viztracer/main.py", line 361, in run_code
exec(code, global_dict)
File "/home/tannewt/repos/circuitpython/ports/raspberrypi/viztracer_asyncio_subprocess.py", line 11, in <module>
asyncio.run(run_echo())
File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/asyncio/runners.py", line 123, in run
raise KeyboardInterrupt()
KeyboardInterrupt
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x796022fe3ba0>
Traceback (most recent call last):
File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 126, in __del__
File "/usr/lib/python3.12/asyncio/base_subprocess.py", line 104, in close
File "/usr/lib/python3.12/asyncio/unix_events.py", line 568, in close
File "/usr/lib/python3.12/asyncio/unix_events.py", line 592, in _close
File "/usr/lib/python3.12/asyncio/base_events.py", line 795, in call_soon
File "/usr/lib/python3.12/asyncio/base_events.py", line 541, in _check_closed
RuntimeError: Event loop is closed
from viztracer.
Thank you so much!
from viztracer.
I installed from source and it works. Thanks again!
from viztracer.
No problem :)
from viztracer.
Related Issues (20)
- Test failed on Arch Linux against Python 3.12 HOT 6
- 无法绑定ip及jupyter中无法更改端口号 HOT 1
- Gives warning: "Found and ignore invalid json file, you may lost some process data." HOT 6
- doesn't pick up existing threads at launch HOT 4
- VizTracer not tracing some functions HOT 1
- Build wheels for free-threading version HOT 3
- [optimize] always add quotes when printing file path HOT 2
- Is it possible to record the function in which tracer is stopped? HOT 3
- Viztracer/vizviewer displays only 1 of N threads with the same name HOT 1
- 关于c++编译的扩展模块中类成员函数没有记录的问题 HOT 6
- 关于长时间记录监控线程导致记录过多的问题 HOT 15
- traced script option parsing is broken HOT 4
- TypeError: CodeMonkey.compile() got an unexpected keyword argument '_feature_version' HOT 3
- Allow users to use `objprint` in `log_func_args` and `log_func_retval`
- Very long process of getting repr of huge objects in torch HOT 7
- clang compile failure: "-Werror -Wunused-command-line-argument" makes "-fno-strict-overflow" fatal HOT 1
- log_sparse=True is not propagated to subprocesses when using multiprocessing with spawn HOT 1
- Ignore python library packages HOT 3
- print class name with member function HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from viztracer.