Skip to content
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

Fixed indefinite loop in roslogging.py #2353

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Conversation

StephanOLC
Copy link

@StephanOLC StephanOLC commented Oct 4, 2023

Raising an ValueError if the caller function can not be found inside RospyLogger::findCaller() instead of looping indefinitly.
Fixes #2352 partially.
It prevents the function from looping indefinitely, but the correct frame is still not found.

Raising an ValueError if the caller function can not be found inside RospyLogger::findCaller() instead of looping indefinitly.
@peci1
Copy link
Contributor

peci1 commented Feb 13, 2024

What if the calling function is the top-level one? Wouldn't that also satisfy the condition that there is no previous frame?

Could you try adding a unit test that fails without the fix and succeeds with it?

@StephanOLC
Copy link
Author

If the top level function is the caller it should be caught by the if clause before.
if filename == file_name and f.f_lineno == lineno and co.co_name == func_name: break
The logic i changed affects going up the stack if the current frame is not the correct one.
if f.f_back: f = f.f_back else: # Reached the last stack frame and found no matching one. raise ValueError("Could not find function [%s] on the framestack"%func_name)

A unit test could certainly be written to test it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RospyLogger stuck in indefinte loop
2 participants