2
$\begingroup$

I am compiling Noetic from source under a Debian 12 bookworm distro for an arm64 SoC. After a successful build and install, if I launch the roscore command, I only see this in the console:

user@tigersd:~$ roscore
... logging to /home/user/.ros/log/0db85c88-c045-11ee-8667-ce581edff282/roslaunch-tigersd-1229.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

The process apparently gets stuck forever. If I hit Ctrl+C, I get the following traces:

^CTraceback (most recent call last):
  File "/opt/ros/noetic/bin/roscore", line 84, in <module>
    roslaunch.main(['roscore', '--core'] + sys.argv[1:])
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/__init__.py", line 347, in main
    p.start()
  File "/opt/ros/noetic/lib/python3/dist-packages/roslaunch/parent.py", line 301, in start
    self.logger.info("starting roslaunch parent run")
  File "/usr/lib/python3.11/logging/__init__.py", line 1489, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.11/logging/__init__.py", line 1622, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py", line 67, in findCaller
    filename = os.path.normcase(co.co_filename)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen posixpath>", line 54, in normcase
KeyboardInterrupt

Looking at the involved Python code, in rosgraph/roslogging.py, class RospyLogger, function findCaller(), apparently the execution never leaves the following loop:

    while hasattr(f, "f_code"):
        # Search for the right frame using the data already found by parent class.
        co = f.f_code
        filename = os.path.normcase(co.co_filename)
        if filename == file_name and f.f_lineno == lineno and co.co_name == func_name:
            break
        if f.f_back:
            f = f.f_back

I added some print traces to see what are the values of the parameters checked in the if statement, and I really don't understand what is happening:

filename = /usr/lib/python3.11/logging/__init__.py, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 1622, lineno = 58, co.co_name = _log, func_name = findCaller
filename = /usr/lib/python3.11/logging/__init__.py, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 1489, lineno = 58, co.co_name = info, func_name = findCaller
filename = /opt/ros/noetic/lib/python3/dist-packages/roslaunch/parent.py, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 301, lineno = 58, co.co_name = start, func_name = findCaller
filename = /opt/ros/noetic/lib/python3/dist-packages/roslaunch/__init__.py, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 347, lineno = 58, co.co_name = main, func_name = findCaller
filename = /opt/ros/noetic/bin/roscore, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 84, lineno = 58, co.co_name = <module>, func_name = findCaller
filename = /opt/ros/noetic/bin/roscore, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 84, lineno = 58, co.co_name = <module>, func_name = findCaller
filename = /opt/ros/noetic/bin/roscore, file_name = /opt/ros/noetic/lib/python3/dist-packages/rosgraph/roslogging.py, f.f_lineno = 84, lineno = 58, co.co_name = <module>, func_name = findCaller
....

I have searched similar topics and I believe I have a regular working network in my system. ROS_IP is not set and ROS_MASTER_URI points to the usual localhost:11311. Ping finds my localhost and other host names as well. Any thoughts what could be happening here?

Thanks all in advance.

$\endgroup$
2
  • 1
    $\begingroup$ Can you tell us how you define "forever"? What HW are you running? $\endgroup$
    – billy
    Commented Jan 31 at 22:17
  • $\begingroup$ I waited around 5 minutes and the master did not start. This process usually just takes a few seconds (3s-5s) in other platforms I have worked with. The HW is a Rockchip RK3588 SoC with 4GB of RAM. $\endgroup$
    – ramonvp
    Commented Feb 1 at 12:45

1 Answer 1

1
$\begingroup$

I found the culprit, however I don't really understand what is happening under the hood. I did not mention in my original post that I have Python 3.11 installed. I am guessing that the RospyLogger wrapper is not compatible with this version of Python. What I did to fix my issue: go to rosgraph/roslogging.py, line 61 and modify to use the module's logging.currentframe() original function:

#f = inspect.currentframe()
f = logging.currentframe()

I found out that other people are experiencing the same issue:

https://github.com/ros/ros_comm/issues/2352

https://github.com/ros/ros_comm/pull/2353

Although my solution does not solve the issue completely, because the output log is now incomplete, I can at least continue porting my code to the new platform:

706880451.911240339 INFO /my_node [(unknown file):0((unknown function))] [topics: /rosout] Hello World INFO

If anyone knows the intrinsics of how the info is organized in the stack, I guess the issue could be solved the right way.

Thanks in advance!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.