[Errno 104] Connection reset by peer

asked 2016-08-06 07:25:07 -0600

highWaters gravatar image

Hello,

I have a bunch of nodes that ask and provide services to each other. Some of them crash after some minutes of execution, and the error is: Service call failed: [Errno 104] Connection reset by peer. I am including part of the code where a service is called.

def call_serve(self, server, myid, request, anyone_index):
    other_service = '/robot' + str(server) + '/serve'
    self.call = self.call + 1

    print 'I am %d calling: %s' % (self.about_me_wm.ID, other_service)

    self.write_log_file('write some values to file')

    -- some calculations

    rospy.wait_for_service(other_service, timeout=60)
    try:
        serve = rospy.ServiceProxy(other_service, Service_One)
        resp1 = serve(myid, request)
        print resp1.outgoing

        -- do some calculation with response

        return resp1.outgoing
    except rospy.ServiceException, e:
        print "Service call failed: %s"%e
        self.write_log_file(self.stdout_log, '[call_serve ' + str(self.call) + '] ' + 'Service call failed: %s'%e)

Normally, there should be a response to each service within 30 secs. I'm not sure if the timeout for rospy.wait_for_service might be the culprit here. Any suggestions?

edit retag flag offensive close merge delete

Comments

Have you considered to use actions? Services are rather thought for small tasks and if something takes minutes, you definitely should use actions so that you can abort and also send feedbacks during the task.

NEngelhard gravatar image NEngelhard  ( 2016-08-06 07:44:36 -0600 )edit

I was not aware of this actually, thanks for the info. However as it is now the tasks are simply while print iterations, and the number of iterations is under 20. The number of nodes is 60 btw. I'm thinking maybe I can use pass in the except so the node doesn't crash; I'm looking for a quick fix now

highWaters gravatar image highWaters  ( 2016-08-06 08:06:51 -0600 )edit