-
Notifications
You must be signed in to change notification settings - Fork 912
RospyLogger stuck in indefinte loop #2352
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
Comments
I had this same issue running noetic compiled on Ubuntu 24.04 with python 3.12. I don't know if it was the ROS code or some change in the behavior of the underlying python that caused this to break (since there was evidently no issue on 20.04), but adding this hack to the top of the function seems to have fixed it for me:
This is a very quick-and-dirty, barely tested first-pass, so I'm open to suggestions for better fixes. |
@StephanOLC Hi, I had found a workaround method. The 'import rosbag' will import 'rosgraph.roslogging', it will lead to invoke 'logging.setLoggerClass(RospyLogger)'. So, we can reset the logger class after importing 'rosbag': import logging
import rosbag
logging.setLoggerClass(logging.Logger) It works for me! |
This fixes an issue described in [this issue](ros/ros_comm#2352 (comment)) Basically, due to python3.12, which is default in styhead, the roslogging is stuck in an infinite loop trying to get the caller stack. Hence, roscore is at 100% CPU but does not work, nor does any other node. This is a different solution as the suggested in the issue. Signed-off-by: Matthias Schoepfer <[email protected]>
By importing rosbag the standard logger is overwritte.
When sending a warning or error the logger is stuck in an indefinte loop.
This can cause other python libraries to malfunction (for example Flask).
To reproduce
Infinite Loop is inside
def findCaller(self, *args, **kwargs):
in roslogging.py.Cause of the issue is:
returns itself as the caller:
Afterwards it tries to find a matching stackframe (skipping the first), but there is none.
The loop to do so is a while loop, but the condition does not change, as
f
is not reassigned if the last frame is reached.There are two things to fix:
super().findCaller()
so it does not return itself rather than the intended function. (Maybe stacklevel)Alternativly do not set the global Logging class to RaspyLogger.
The text was updated successfully, but these errors were encountered: