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

Talker crashes when it tries to publish on a topic it doesn't have permission to use #57

Open
sloretz opened this issue Jun 22, 2018 · 7 comments
Labels
bug Something isn't working

Comments

@sloretz
Copy link
Contributor

sloretz commented Jun 22, 2018

Bug report

Required Info:

Steps to reproduce issue

Policy file: https://raw.githubusercontent.com/ros2/sros2/ardent/examples/sample_policy.yaml

md C:\dev\sros2_demo
md C:\dev\sros2_demo\demo_keys
REM copy policy file as policies.yaml into demo_keys
cd C:\dev\sros2_demo
set RANDFILE=C:\dev\sros2_demo\.rnd

ros2 security create_keystore demo_keys
ros2 security create_key demo_keys talker
ros2 security create_key demo_keys listener
ros2 security create_permission demo_keys talker demo_keys/policies.yaml
ros2 security create_permission demo_keys listener demo_keys/policies.yaml

REM Launch the c++ talker
set ROS_SECURITY_ROOT_DIRECTORY=%cd%/demo_keys
set ROS_SECURITY_ENABLE=true
set ROS_SECURITY_STRATEGY=Enforce
ros2 run demo_nodes_cpp talker /chatter:=/something/else

REM next try rclpy
ros2 run demo_nodes_py talker /chatter:=/something/else

Expected behavior

Processes would exit with a non-zero return code

Actual behavior

Processes seem to crash (Windows dialog pops up saying process crashed)

Additional information

python talker manages to print a traceback before crashing

>ros2 run demo_nodes_py talker /chatter:=/something/else
Traceback (most recent call last):
  File "C:\dev\ros2-windows\lib\demo_nodes_py\talker-script.py", line 11, in <module>
    load_entry_point('demo-nodes-py==0.4.0', 'console_scripts', 'talker')()
  File "C:\dev\ros2-windows\Lib\site-packages\demo_nodes_py\topics\talker.py", line 46, in main
    node = Talker()
  File "C:\dev\ros2-windows\Lib\site-packages\demo_nodes_py\topics\talker.py", line 28, in __init__
    self.pub = self.create_publisher(String, 'chatter')
  File "C:\dev\ros2-windows\Lib\site-packages\rclpy\node.py", line 115, in create_publisher
    self.handle, msg_type, topic, qos_profile.get_c_qos_profile())
RuntimeError: Failed to create publisher: create_publisher() could not create publisher, at C:\J\workspace\packaging_windows\ws\src\ros2\rmw_fastrtps\rmw_fastrtps_cpp\src\rmw_publisher.cpp:132, at C:\J\workspace\packaging_windows\ws\src\ros2\rcl\rcl\src\rcl\publisher.c:173
[SECURITY
@sloretz sloretz added the bug Something isn't working label Jun 22, 2018
@mikaelarguedas
Copy link
Member

This is currently expected behavior.
All failing python calls currently raise RuntimeError in rclpy (ros2/rclpy#31)

We could catch those but I'm not sure what the expected behavior is. Just return with non-zero without a specific error message ?

@dirk-thomas
Copy link
Member

Many of our existing tools try / except RuntimeError in the main and print the error message to stderr and sys.exit with non-zero. It is used to signal "known" errors without showing the user a stacktrace.

@sloretz
Copy link
Contributor Author

sloretz commented Jun 22, 2018

Exiting with a traceback is what I'd expect. What I don't expect is to see is this dialog. It does not normally appear when a node exits with a traceback.

talkercrash

Edit: and with c++ node
talkercrashcpp

@mikaelarguedas
Copy link
Member

Many of our existing tools try / except RuntimeError in the main and print the error message to stderr and sys.exit with non-zero. It is used to signal "known" errors without showing the user a stacktrace.

Sure, we can make a PR to the demos repo to catch all node creation failures in the python nodes 👍
It's moving away from them being minimalistic but I guess that's something we cannot work around

@dirk-thomas
Copy link
Member

I think in this case it makes sense to keep the stacktrace since it is an "unexpected" error and the stacktrace help the user to determine where the problem is.

@mikaelarguedas
Copy link
Member

@sloretz @dirk-thomas What is the next action item on this ?
Finding a way to silence the pop-up but keep the stacktrace ?

@sloretz do you have the same behavior with connext or only fastrtps?

@dirk-thomas
Copy link
Member

Finding a way to silence the pop-up but keep the stacktrace ?

We have to understand why there is popup in the first place. I don't think that the Python code controls/triggers that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants