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

exception when listing parameters and there are two nodes with the same name #231

Open
wjwwood opened this issue Aug 22, 2018 · 1 comment
Labels
backlog bug Something isn't working

Comments

@wjwwood
Copy link
Member

wjwwood commented Aug 22, 2018

Bug report

Required Info:

  • Operating System:
    • macOS
  • Installation type:
    • bouncy patch 2 rc
  • DDS implementation:
    • Fast-RTPS
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

% ros2 run demo_nodes_cpp listener &
% ros2 run demo_nodes_cpp listener &
% ros2 param set listener foo.bar.baz True
...
% ros2 param list
...

Expected behavior

Some times the last command will return:

% ros2 param list
listener:
  foo.bar.baz

Actual behavior

Some times the last command will return:

% ros2 param list
Traceback (most recent call last):
  File "/tmp/ros2-osx/bin/ros2", line 11, in <module>
    load_entry_point('ros2cli==0.5.4', 'console_scripts', 'ros2')()
  File "/tmp/ros2-osx/lib/python3.7/site-packages/ros2cli/cli.py", line 69, in main
    rc = extension.main(parser=parser, args=args)
  File "/tmp/ros2-osx/lib/python3.7/site-packages/ros2param/command/param.py", line 40, in main
    return extension.main(args=args)
  File "/tmp/ros2-osx/lib/python3.7/site-packages/ros2param/verb/list.py", line 81, in main
    rclpy.spin_until_future_complete(node, futures[node_name])
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/__init__.py", line 126, in spin_until_future_complete
    executor.spin_until_future_complete(future)
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/executors.py", line 218, in spin_until_future_complete
    self.spin_once()
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/executors.py", line 528, in spin_once
    raise handler.exception()
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/task.py", line 206, in __call__
    self._handler.send(None)
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/executors.py", line 308, in handler
    await call_coroutine(entity, arg)
  File "/tmp/ros2-osx/lib/python3.7/site-packages/rclpy/executors.py", line 253, in _execute_client
    future = client._pending_requests[sequence]
KeyError: 1

Additional information

I think this is a violation of the assumption that nodes have unique names (violated by running listener twice without renaming at least one of them), but this error in the executor could probably be made more robust and/or informative.

Separately, this underscores the need to resolve the node name uniqueness issue, see: ros2/design#187

@wjwwood wjwwood added the bug Something isn't working label Aug 22, 2018
@tfoote
Copy link
Contributor

tfoote commented Sep 13, 2018

I've debugged into this but haven't found the root cause yet. I believe @wjwwood's speculation that it's coming from the duplicately named nodes is correct, but haven't found the code path for the collision.

Digging through the call stack and tracing the values back up here are my notes so far.

KeyError:1

future = client._pending_requests[sequence]

future = client._pending_requests[sequence]

sequence is 1 expects 0

Callig coroutine

https://github.com/ros2/rclpy/blob/master/rclpy/rclpy/executors.py#L310

await call_coroutine(entity, arg)

arg comes from

arg = take_from_wait_list(entity)

arg = take_from_wait_list(entity)

_make_request

take_from_wait_list is invocation of

def _take_service(self, srv):

Which calls through to the CAPI

rclpy_take_request(PyObject * Py_UNUSED(self), PyObject * args)

/// Take a request from a given service
/**
 * Raises ValueError if pyservice is not a service capsule
 *
 * \param[in] pyservice Capsule pointing to the service to process the request
 * \param[in] pyrequest_type Instance of the message type to take
 * \return List with 2 elements:
 *            first element: a Python request message with all fields populated with received request
 *            second element: a Capsule pointing to the header (rmw_request_id) of the processed request
 */
static PyObject *
rclpy_take_request(PyObject * Py_UNUSED(self), PyObject * args)

@tfoote tfoote removed their assignment May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants