Bug 734715 - Improve devicemanagerSUT socket diagnostics. r=jmaher
authorGeoff Brown <gbrown@mozilla.com>
Tue, 03 Apr 2012 20:08:27 -0400
changeset 94264 d3d336a9d86afe519619ebd2e7726ce70c5964c3
parent 94263 85a83632b3c43d2e0f9c589ae973159b5a9bf742
child 94265 d754f0fb17e68d24212dac21b70d3463ece6e464
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs734715
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 734715 - Improve devicemanagerSUT socket diagnostics. r=jmaher
build/mobile/devicemanagerSUT.py
--- a/build/mobile/devicemanagerSUT.py
+++ b/build/mobile/devicemanagerSUT.py
@@ -194,40 +194,42 @@ class DeviceManagerSUT(DeviceManager):
     shouldCloseSocket = False
     recvGuard = 1000
 
     if not self._sock:
       try:
         if self.debug >= 1:
           print "reconnecting socket"
         self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-      except:
+      except socket.error, msg:
         self._sock = None
-        raise AgentError("unable to create socket")
+        raise AgentError("unable to create socket: "+str(msg))
 
       try:
         self._sock.connect((self.host, int(self.port)))
         self._sock.recv(1024)
-      except:
+      except socket.error, msg:
         self._sock.close()
         self._sock = None
-        raise AgentError("unable to connect socket")
+        raise AgentError("unable to connect socket: "+str(msg))
 
     for cmd in cmdlist:
       if newline: cmd += '\r\n'
 
       try:
         numbytes = self._sock.send(cmd)
         if (numbytes != len(cmd)):
           raise AgentError("ERROR: our cmd was %s bytes and we only sent %s" % (len(cmd),
                                                                                 numbytes))
         if (self.debug >= 4): print "send cmd: " + str(cmd)
-      except:
+      except socket.error, msg:
         self._sock.close()
         self._sock = None
+        if self.debug >= 1:
+          print "Error sending data to socket. cmd="+str(cmd)+"; err="+str(msg)
         return False
 
       # Check if the command should close the socket
       shouldCloseSocket = self._shouldCmdCloseSocket(cmd)
 
       # Handle responses from commands
       if (self._cmdNeedsResponse(cmd)):
         found = False
@@ -237,20 +239,20 @@ class DeviceManagerSUT(DeviceManager):
         while (found == False and (loopguard < recvGuard)):
           temp = ''
           if (self.debug >= 4): print "recv'ing..."
 
           # Get our response
           try:
             temp = self._sock.recv(1024)
             if (self.debug >= 4): print "response: " + str(temp)
-          except:
+          except socket.error, msg:
             self._sock.close()
             self._sock = None
-            raise AgentError("Error receiving data from socket")
+            raise AgentError("Error receiving data from socket. cmd="+str(cmd)+"; err="+str(msg))
 
           data += temp
 
           # If something goes wrong in the agent it will send back a string that
           # starts with '##AGENT-ERROR##'
           if self.agentErrorRE.match(data):
             raise AgentError("Agent Error processing command: %s" % cmd, fatal=True)