You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, there is really no need to throw an exception at this point that callers of rclpy.spin would need to handle; we could instead just return a value indicating why the spin stopped. This would make it so users need less error-handling code, make this act more like rclcpp (which doesn't throw an exception here), and still provide information in case somebody wants to know why the spin stopped.
Further, we can easily stop throwing an exception here with no impact to downstream consumers. If they aren't handling the exception today, this will just make it a bit more robust. If they are handling ExternalShutdownException today, then that effectively becomes dead code but nothing really breaks.
The text was updated successfully, but these errors were encountered:
No.
This exception was useful because the multi-threaded executor does NOT shutdown cleanly so we can catch this exception and ignore it.
Now it throws a generic RuntimeError so ignoring it is unadvised.
Now we're checking strings to decide if we report an exception or not.
File ".../ros/node.py", line 433, in spin self._executor.spin() File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 294, in spin self.spin_once() File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 794, in spin_once self._spin_once_impl(timeout_sec) File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 786, in _spin_once_impl self._executor.submit(handler) File "/usr/lib/python3.10/concurrent/futures/thread.py", line 167, in submit raise RuntimeError('cannot schedule new futures after shutdown') RuntimeError: cannot schedule new futures after shutdown
This is an issue split out of ros2/examples#379
Currently the rclpy executor can throw an
ExternalShutdownException
:rclpy/rclpy/rclpy/executors.py
Line 689 in 99f1ce9
However, there is really no need to throw an exception at this point that callers of
rclpy.spin
would need to handle; we could instead just return a value indicating why the spin stopped. This would make it so users need less error-handling code, make this act more like rclcpp (which doesn't throw an exception here), and still provide information in case somebody wants to know why the spin stopped.Further, we can easily stop throwing an exception here with no impact to downstream consumers. If they aren't handling the exception today, this will just make it a bit more robust. If they are handling
ExternalShutdownException
today, then that effectively becomes dead code but nothing really breaks.The text was updated successfully, but these errors were encountered: