Skip to content

Memray not working on generated binary file #583

Closed Answered by godlygeek
Partho asked this question in Q&A
Discussion options

You must be logged in to vote

Well, 0 bytes is definitely wrong... after the with block ends, that file should definitely not be empty (though it can be while tracking is still running).

Perhaps a new request came in and a new Tracker started, overwriting the file before it could be read??

memray.Tracker sets up global state - there can only be one instance of it active at a time. If a second request comes in before that first one has finished, nothing good is going to happen - I think the failure mode might be that it successfully overwrites the file before it eventually fails to activate tracking, resulting in an empty file being left around.

Something like this (untested) might do the trick:

class MaybeTracker:
    d…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Partho
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants