sock is None before invoking deleteSession

RESOLVED INVALID

Status

RESOLVED INVALID
4 years ago
9 months ago

People

(Reporter: pyang, Unassigned)

Tracking

({pi-marionette-client})

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
in marionette_transport

File "/marionette_client_mozilla_b2g37_v2_2-0.1-py2.7.egg/marionette/runner/base.py", line 751, in run_tests
     if self.capabilities['device'] != 'desktop' and self.capabilities['browserName'] == 'B2G':
marionette_client_mozilla_b2g37_v2_2-0.1-py2.7.egg/marionette/runner/base.py", line 574, in capabilities
     self.marionette.delete_session()
   File "/marionette_client_mozilla_b2g37_v2_2-0.1-py2.7.egg/marionette/marionette.py", line 839, in delete_session
     response = self._send_message('deleteSession', 'ok')
   File "/marionette_client_mozilla_b2g37_v2_2-0.1-py2.7.egg/marionette/decorators.py", line 36, in _
     return func(*args, **kwargs)
   File "/marionette_client_mozilla_b2g37_v2_2-0.1-py2.7.egg/marionette/marionette.py", line 609, in _send_message
     response = self.client.send(message)
   File "/marionette_transport-0.4-py2.7.egg/marionette_transport/transport.py", line 96, in send
     self.sock.send(packet)
 AttributeError: 'NoneType' object has no attribute 'send'

Looks like we didn't protect when sock is set as None.
(Reporter)

Comment 1

4 years ago
Andreas, I found bug1157273 for marionette-server, are they related?
(Reporter)

Updated

4 years ago
Flags: needinfo?(ato)
If `self.sock` isn’t defined on calling the `send` routine in marionette_transport, we reconnect on transport.py:86:

        if not self.sock:
            self.connect()

The only slightly suspicious thing about is that we’re relying on the coerced boolean value of `self.sock` instead of explicitly testing for None-ness as such:

        if self.sock is not None:
            self.connect()

I don’t think what you’re seeing is related to bug 1157273 as that is more a theoretical bug limited to the server.  It _could_ potentially manifest itself if you create and delete a session very rapidly in succession, but as I said I don’t think it’s related.

Do you have a reliable way to reproduce the error you’re seeing?  From reading the code I can’t immediately think of anything that would cause this to happen.  Perhaps some code is writing directly to transport.py’s internals and resetting `self.sock`, but that seems unlikely.
Flags: needinfo?(ato)
(Reporter)

Comment 3

4 years ago
I triggered 5 machines yesterday and 1 of them reproduced in 2 hours.
likely an unexpected flow and it didn't trigger reconnecting.
(Reporter)

Comment 5

4 years ago
That is rational and I saw many failures with "self.capabilities". Probably we can maintain session other than use it disposable.  
Just check new test run and haven't encountered.  

We can inject log or patch at next run, any suggestion?
Keywords: ateam-marionette-client
transport.py has changed significantly since this was filed.
Status: NEW → RESOLVED
Last Resolved: 9 months ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.