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

Fix user data unpacking in noetic #57

Draft
wants to merge 1 commit into
base: melodic-devel
Choose a base branch
from

Conversation

corot
Copy link

@corot corot commented Nov 4, 2023

⚠️⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️
TODO: create noetic-devel branch and change the target for this PR
I will keep as draft meanwhile
⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️

Without this PR, on noetic, unpacking any user data fails with

[/patrol_2_points_smach_viewer ERROR 1699086106.199530, 6.800000]: bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame object at 0x7f0440864550>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/home/jorge/catkin_ws/executive/src/executive_smach_visualization/smach_viewer/scripts/smach_viewer.py", line 530, in _status_msg_update
    SmachViewerBase._status_msg_update(self, msg)
  File "/home/jorge/catkin_ws/executive/src/executive_smach_visualization/smach_viewer/src/smach_viewer/smach_viewer_base.py", line 490, in _status_msg_update
    if container.update_status(msg):
  File "/home/jorge/catkin_ws/executive/src/executive_smach_visualization/smach_viewer/src/smach_viewer/smach_viewer_base.py", line 102, in update_status
    self._local_data._data = self._load_local_data(msg)
  File "/home/jorge/catkin_ws/executive/src/executive_smach_visualization/smach_viewer/src/smach_viewer/smach_viewer_base.py", line 75, in _load_local_data
    local_data = pickle.loads(
_pickle.UnpicklingError: pickle data was truncated

@corot corot marked this pull request as draft November 4, 2023 08:30
@k-okada
Copy link
Contributor

k-okada commented Nov 4, 2023

@corot can you provide example code to reproduce this problem?
@tkmtnt7000 can you check if this patch works on your example #54 (comment) ?

@corot
Copy link
Author

corot commented Nov 4, 2023

@corot can you provide example code to reproduce this problem?

To my understanding, this is a general problem in noetic. i.e. decoding any msg fails. Which makes sense because we encode using base64.

Can you visualize userdata on noetic w/o this fix?

@tkmtnt7000
Copy link
Contributor

tkmtnt7000 commented Nov 4, 2023

@tkmtnt7000 can you check if this patch works on your example #54 (comment) ?

Yes, but at this time it seems that this PR has not fixed the visualization failure yet.
And I did not encounter the error above with the sample code #54 (comment), so I would like to know how that error reproduces.

I got the following error with #54 code.

[ERROR] [1699329194.390787] [/smach_viewer]: [bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame object at 0x7fcfd497d8b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 75, in _load_local_data
    local_data = pickle.loads(msg.local_data)
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/base64.py", line 37, in _bytes_from_decode_data
    return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 27-32: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/noetic/lib/smach_viewer/smach_viewer.py", line 530, in _status_msg_update
    SmachViewerBase._status_msg_update(self, msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 492, in _status_msg_update
    if container.update_status(msg):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 104, in update_status
    self._local_data._data = self._load_local_data(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 78, in _load_local_data
    local_data = pickle.loads(base64.b64decode(msg.local_data))
  File "/usr/lib/python3.8/base64.py", line 80, in b64decode
    s = _bytes_from_decode_data(s)
  File "/usr/lib/python3.8/base64.py", line 39, in _bytes_from_decode_data
    raise ValueError('string argument should contain only ASCII characters')
ValueError: string argument should contain only ASCII characters
]
[ERROR] [1699329195.381758] [/smach_viewer]: [bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame object at 0x7fcfd497d8b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 75, in _load_local_data
    local_data = pickle.loads(msg.local_data)
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/base64.py", line 37, in _bytes_from_decode_data
    return s.encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode characters in position 25-26: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/noetic/lib/smach_viewer/smach_viewer.py", line 530, in _status_msg_update
    SmachViewerBase._status_msg_update(self, msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 492, in _status_msg_update
    if container.update_status(msg):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 104, in update_status
    self._local_data._data = self._load_local_data(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 78, in _load_local_data
    local_data = pickle.loads(base64.b64decode(msg.local_data))
  File "/usr/lib/python3.8/base64.py", line 80, in b64decode
    s = _bytes_from_decode_data(s)
  File "/usr/lib/python3.8/base64.py", line 39, in _bytes_from_decode_data
    raise ValueError('string argument should contain only ASCII characters')
ValueError: string argument should contain only ASCII characters
]
[ERROR] [1699329196.382061] [/smach_viewer]: [bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame object at 0x7fcfd497d8b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 75, in _load_local_data
    local_data = pickle.loads(msg.local_data)
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/noetic/lib/smach_viewer/smach_viewer.py", line 530, in _status_msg_update
    SmachViewerBase._status_msg_update(self, msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 492, in _status_msg_update
    if container.update_status(msg):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 104, in update_status
    self._local_data._data = self._load_local_data(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 78, in _load_local_data
    local_data = pickle.loads(base64.b64decode(msg.local_data))
  File "/usr/lib/python3.8/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
]
[ERROR] [1699329197.381978] [/smach_viewer]: [bad callback: <bound method SmachViewerFrame._status_msg_update of <__main__.SmachViewerFrame object at 0x7fcfd497d8b0>>
Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 75, in _load_local_data
    local_data = pickle.loads(msg.local_data)
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/ros/noetic/lib/python3/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "/opt/ros/noetic/lib/smach_viewer/smach_viewer.py", line 530, in _status_msg_update
    SmachViewerBase._status_msg_update(self, msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 492, in _status_msg_update
    if container.update_status(msg):
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 104, in update_status
    self._local_data._data = self._load_local_data(msg)
  File "/opt/ros/noetic/lib/python3/dist-packages/smach_viewer/smach_viewer_base.py", line 78, in _load_local_data
    local_data = pickle.loads(base64.b64decode(msg.local_data))
  File "/usr/lib/python3.8/base64.py", line 87, in b64decode
    return binascii.a2b_base64(s)
binascii.Error: Incorrect padding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants