Bug 1413852 - TcpTransport.receive() doesn't obey current socket timeout. r=automatedtester
authorHenrik Skupin <mail@hskupin.info>
Thu, 02 Nov 2017 11:33:23 +0100
changeset 443195 de33c2cf6efbb0f1fa768a1821124d4c2e07f2c1
parent 443194 ab9c6e310379c674d97e0337098a260197f08487
child 443196 06a8c0a3322509da4cc9e7bb780ac204e061cfe7
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersautomatedtester
bugs1413852
milestone58.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 1413852 - TcpTransport.receive() doesn't obey current socket timeout. r=automatedtester The getter for socket_timeout should always return the current socket timeout from the socket instance first, and only fallback to the private property if no socket instance exists. This ensures that all methods will always operate on the current socket timeout value. Also using a timeout of 2s for receiving the hello string might be too less for slow running builds. To prevent intermittent failures for start_session, a good value might be 60s. MozReview-Commit-ID: HywjFfClrRr
testing/marionette/client/marionette_driver/transport.py
--- a/testing/marionette/client/marionette_driver/transport.py
+++ b/testing/marionette/client/marionette_driver/transport.py
@@ -104,23 +104,27 @@ class TcpTransport(object):
         self.protocol = self.min_protocol_level
         self.application_type = None
         self.last_id = 0
         self.expected_response = None
         self.sock = None
 
     @property
     def socket_timeout(self):
+        if self.sock:
+            return self.sock.gettimeout()
+
         return self._socket_timeout
 
     @socket_timeout.setter
     def socket_timeout(self, value):
+        self._socket_timeout = value
+
         if self.sock:
             self.sock.settimeout(value)
-        self._socket_timeout = value
 
     def _unmarshal(self, packet):
         msg = None
 
         # protocol 3 and above
         if self.protocol >= 3:
             typ = int(packet[1])
             if typ == Command.TYPE:
@@ -187,17 +191,17 @@ class TcpTransport(object):
 
             self.sock.connect((self.addr, self.port))
         except:
             # Unset self.sock so that the next attempt to send will cause
             # another connection attempt.
             self.sock = None
             raise
 
-        with SocketTimeout(self.sock, 2.0):
+        with SocketTimeout(self.sock, 60.0):
             # first packet is always a JSON Object
             # which we can use to tell which protocol level we are at
             raw = self.receive(unmarshal=False)
         hello = json.loads(raw)
         self.protocol = hello.get("marionetteProtocol", self.min_protocol_level)
         self.application_type = hello.get("applicationType")
 
         return (self.protocol, self.application_type)