python-hunter icon indicating copy to clipboard operation
python-hunter copied to clipboard

Removing previous tracers

Open robinsonkwame opened this issue 6 years ago • 5 comments

Excellent library, I just started using hunter and have really enjoyed using it.

While playing around with hunter and trace I find that I have a lot of previous references to tracers that I no longer need.

hunter.stop() will set _last_tracer to None but if I make another call to hunter.trace(...) the previous tracers are shown to still reside in memory.

What's the best way to clear out unneeded tracers in hunter?

robinsonkwame avatar Apr 01 '19 18:04 robinsonkwame

This sounds like a bug? Do you have an example of how you see the prev tracer still lingering around?

Either way the prev tracer area is going to get some rework to make coverage work smoothly so it would be great to get your example tested.

ionelmc avatar Apr 02 '19 13:04 ionelmc

@robinsonkwame any update?

ionelmc avatar May 29 '19 13:05 ionelmc

Sorry, I just haven't had time to pursue this. I think I discovered that while previous tracers were listed in memory they weren't firing if they were shutdown, but I'd have to attempt to recreate the problem again.

On Wed, May 29, 2019 at 9:50 AM Ionel Cristian Mărieș < [email protected]> wrote:

@robinsonkwame https://github.com/robinsonkwame any update?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ionelmc/python-hunter/issues/59?email_source=notifications&email_token=AB5ESR4Y32E2TYOAYFNPJRDPX2C3VA5CNFSM4HCZP4DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWPMQRQ#issuecomment-496945222, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5ESRYZZDAYDHITZJ6TZLLPX2C3VANCNFSM4HCZP4DA .

robinsonkwame avatar May 29 '19 14:05 robinsonkwame

@robinsonkwame what do you mean by "they were shutdown"?

ionelmc avatar May 29 '19 14:05 ionelmc

@robinsonkwame also note that hunter does not warn you about using it like this:

hunter.trace()
hunter.trace()

or:

with hunter.trace():
    with hunter.trace():
        ...

Maybe we could have some sort of warning but how I'd know if the user didn't actually intend to have multiple tracing scopes?

ionelmc avatar Jun 01 '19 22:06 ionelmc