ros-teleop / teleop_tools

A set of generic teleoperation tools for any robot.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reason for persistent service ??

artivis opened this issue · comments

Any particular reason for the AsyncServiceProxy to create ServiceProxy with the persistent parameter set to True by default ???

Setting this parameter to True is discouraged by the rospy doc. Moreover it seems to trigger some un-handled Interrupted system call.
My use-case is a simple start service mapped to a button. First button click goes fine, second click triggers the following crash:

On the service server side :

File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 660, in handle
    requests = transport.receive_once()
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 750, in receive_once
    raise TransportException("receive_once[%s]: unexpected error %s"%(self.name, str(e)))
TransportException: receive_once[/my_srv/start]: unexpected error [Errno 4] Interrupted system call

On the client side:

process[joy_teleop-1]: started with pid [945]
process[joystick-2]: started with pid [950]
Exception in thread Thread-61:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 435, in __call__
    return self.call(*args, **kwds)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 525, in call
    raise ServiceException("transport error completing service call: %s"%(str(e)))
ServiceException: transport error completing service call: unable to receive data from sender, check sender's logs for details

When clicking a third time (and further), the error on the client side is then:

Exception in thread Thread-62:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 435, in __call__
    return self.call(*args, **kwds)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_service.py", line 512, in call
    transport.send_message(request, self.seq)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 666, in send_message
    self.write_data(self.write_buff.getvalue())
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/impl/tcpros_base.py", line 690, in write_data
    raise TransportTerminated(str(errno)+msg)
TransportTerminated: 32Broken pipe

Quickly browsing the web, the initial issue on the server side seems to be due to a known python 2.7 feature.

Finally, setting the default value of persistent to False, everything goes fine.

This was specifically for call performance reasons.
Would you be up for providing a pull request adding a new parameter for this? The default could be false.

Closing this issue, #29 merged.