-
Notifications
You must be signed in to change notification settings - Fork 434
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I’m hitting a crash when using Memray with gevent.
Memray correctly writes the profile .bin file, but then crashes during shutdown in
Tracker.__exit__ with an AttributeError on threading.Thread._name.
/tmp/gevent_memray > python -m memray run test_memray_gevent.py py gevent_memray 08:55:33 PM
Writing profile results into memray-test_memray_gevent.py.917120.bin
⚠ Memray support for Greenlet is experimental ⚠
Please report any issues at https://github.com/bloomberg/memray/issues
[memray] Successfully generated profile results.
You can now generate reports from the stored allocation records.
Some example commands to generate reports:
/tmp/gevent_memray/.venv/bin/python -m memray flamegraph memray-test_memray_gevent.py.917120.bin
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/tmp/gevent_memray/.venv/lib/python3.13/site-packages/memray/__main__.py", line 6, in <module>
sys.exit(main())
~~~~^^
File "/tmp/gevent_memray/.venv/lib/python3.13/site-packages/memray/commands/__init__.py", line 138, in main
arg_values.entrypoint(arg_values, parser)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
File "/tmp/gevent_memray/.venv/lib/python3.13/site-packages/memray/commands/run.py", line 338, in run
_run_with_file_output(args)
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/tmp/gevent_memray/.venv/lib/python3.13/site-packages/memray/commands/run.py", line 187, in _run_with_file_output
_run_tracker(
~~~~~~~~~~~~^
destination=destination,
^^^^^^^^^^^^^^^^^^^^^^^^
args=args,
^^^^^^^^^^
post_run_message=example_report_generation_message,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/tmp/gevent_memray/.venv/lib/python3.13/site-packages/memray/commands/run.py", line 56, in _run_tracker
with tracker:
^^^^^^^
File "src/memray/_memray.pyx", line 861, in memray._memray.Tracker.__exit__
File "src/memray/_memray.pyx", line 867, in memray._memray.Tracker.__exit__
AttributeError: type object 'Thread' has no attribute '_name'. Did you mean: 'name'?Expected Behavior
No response
Steps To Reproduce
Code used
import gevent
from gevent import monkey
monkey.patch_all()
def worker():
data = b"x" * 1024
gevent.sleep(0.01)
return data
def main():
jobs = [gevent.spawn(worker) for _ in range(5)]
gevent.joinall(jobs)
if __name__ == "__main__":
main()Command used:
python -m memray run test_memray_gevent.pyMemray Version
1.19.1
Python Version
3.13
Operating System
Linux
Anything else?
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working