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

Publishing a message of the wrong type can cause a hard error #314

Closed
rotu opened this issue Apr 17, 2019 · 1 comment · Fixed by #317
Closed

Publishing a message of the wrong type can cause a hard error #314

rotu opened this issue Apr 17, 2019 · 1 comment · Fixed by #317
Assignees
Labels
enhancement New feature or request

Comments

@rotu
Copy link
Contributor

rotu commented Apr 17, 2019

Bug report

Required Info:

  • Operating System:
    • Windows 10
  • Installation type:
    • binaries
  • Version or commit hash:
  • DDS implementation:
  • Client library (if applicable):
    • rclpy

Steps to reproduce issue

import rclpy
rclpy.init()
import std_msgs.msg

n = rclpy.create_node('mynode')
p = n.create_publisher(std_msgs.msg.UInt32,'mytopic')
p.publish(42)

Expected behavior

Either the value is converted silently to the compatible message type or a catchable error is thrown.

Actual behavior

The python interpreter crashes and the following is found in Event Viewer:

Faulting application name: python.exe, version: 3.7.3150.1013, time stamp: 0x5c9954fa
Faulting module name: unknown, version: 0.0.0.0, time stamp: 0x00000000
Exception code: 0xc0000005
Fault offset: 0x0000000000000000
Faulting process id: 0x73b0
Faulting application start time: 0x01d4f4e426ff3935
Faulting application path: C:\Python37\python.exe
Faulting module path: unknown
Report Id: 682bc596-629a-4933-962f-ffe339ad65c1
Faulting package full name: 
Faulting package-relative application ID: 

Additional information

In the file publisher.py, there should probably be a check isinstance(msg, self.msg_type) or type(msg) is self.msg_type and a TypeError thrown.

@dirk-thomas dirk-thomas self-assigned this Apr 22, 2019
@dirk-thomas dirk-thomas added enhancement New feature or request in progress Actively being worked on (Kanban column) labels Apr 22, 2019
@dirk-thomas
Copy link
Member

Thanks for the report. PR #317 address this for publishing messages as well as various other API.

In the future when you have a specific proposal please consider to create a pull request for it.

@dirk-thomas dirk-thomas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Apr 22, 2019
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants