google / mobly

E2E test framework for tests with complex environment requirements.
https://github.com/google/mobly
Apache License 2.0
647 stars 179 forks source link

Zombie port on host when `AndroidDevice.handle_usb_disconnect` is used #512

Closed xpconanfan closed 6 years ago

xpconanfan commented 6 years ago

In AndroidDevice.handle_usb_disconnect, we never explicitly stop snippet client's port forwarding. Then during service restoration, a new host port is allocated for the snippet client.

This causes leftover ports in adb port forwarding, which on rare occasions can trigger an adb bug where adb forward --list command fails, which crashes Mobly.