-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attach
ignores --duration
#701
Comments
I can also confirm that it does not work for me. Version1.13.4 Python Version3.8 Steps To ReproduceTry attaching to a running uvicorn process. |
Ok, I believe I figured out the issue. The tracking works, but the CLI exits before the set duration is complete. If you check the terminal running the uvicorn process, you'll see a message:
The captured file updates for the full duration, as seen in the modification time, and the flamegraph reflects the correct duration. This behavior is confusing. It also means that if you press Ctrl+C to stop the memray process, the capture will still run in the background until the set duration ends. |
That's right -
What do you mean by "stop the memray process" - do you mean that you ctrl-c the call to
The docs do say:
as well as that
and |
@godlygeek I am sorry for not reading. Thank you for being patient with me and kindly pointing it out. I can see adding the following line right below Tip Use memray detach to stop tracking manually, or allow it to stop automatically when the specified duration ends. That said, in my opinion, this may not significantly improve the documentation, as the current version already seems clear and sufficient. |
@godlygeek thank you for the explanation. I agree that this behavior is document perfectly fine. I do think though that it is bad (or at least surprising) UX. It is to me very unexpected that a command-line tool returns before its work is finished without explicit request:
|
Is there an existing issue for this?
Current Behavior
It ignores duration.
Expected Behavior
No response
Steps To Reproduce
I don't know, I just attached to a running FastAPI/uvicorn process.
Memray Version
1.14.0
Python Version
3.12
Operating System
Linux
Anything else?
No response
The text was updated successfully, but these errors were encountered: