Repository navigation
Too many TIME_WAIT state. #173
Copy link
Copy link
Open
Description
Activity
Can you please provide the source code (perhaps only the relevant part) of your test script?
I have been running tests for hour and even days with no problems so I think the reason might be the way you are using it.
class Action(object): @staticmethod def runMonkeyTest(testManager, seq, duration, testReport_id, scriptLogPath): while substractTime < duration: if monkeyAction == 1 : #do action captureScreenImageAndSaveFile(...) if not Galileo_Action.tap(testManager, [(xPos, yPos)], 500): pass if monkeyAction == 2 : #do action captureScreenImageAndSaveFile(...) if not Galileo_Action.swipe(testManager, (xPos , yPos), (xPos2, yPos2), swipeDuration): pass ...- Set AdbClient Instance (adbclient.py > def __init(self, ...)
- 53863 port opened at "self.socket = AdbClient.connect(self.hostname, self.port, self.timeout)" line156.
- "self.checkVersion(ignoreversioncheck)" function called and 53863 turn to TIME_WAIT state, and new port 53869 are oppend.
- After "devices = self.getDevices()" called, new port is opeend. (adbclient.py > def __setTransport(self))
- If I pass "reconnect=True" argument, It cause recursion error
def getDevices(self): if DEBUG: print >> sys.stderr, "getDevices()" self.__send('host:devices-l', checkok=False, **reconnect=True**)- I'm worried about this issues repeat, so huge ports are stayed at TIME_WAIT state.
It caused by graceful shutdown when send&recv with adb server(5037). It's absolutely normal process I guess. But in my case, it cause throttling, so I set linger option when connect socket. It makes a new connection not left TIME_WAIT port.
`
def connect(hostname, port, timeout=TIMEOUT): if DEBUG: print >> sys.stderr, "AdbClient.connect(%s, %s, %s)" % (hostname, port, timeout) s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) l_onoff = 1 l_linger = 0 s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', l_onoff, l_linger)) s.settimeout(timeout) try: s.connect((hostname, port)) except socket.error, ex: raise RuntimeError("ERROR: Connecting to %s:%d: %s.\nIs adb running on your computer?" % (s, port, ex)) return s`
- added a commit that references this issue
on Feb 11, 2016 It seems like a good idea.
I've created the patch (3f1f286) and gave you credit.
Thanks.
Metadata
Metadata
Assignees
Labels
No labels
Hi. First of all, thanks for you greate library. It's very useful and giving a lot of greate functions to develope my project.
I have some problem, I wrote script for monkey test(doing irregular actions), and found it adbClient left a lots of ports TIME_WAIT. I guess it creates ports every function related adb command and left ports TIME_WAIT state. When I continued 12 hours for several devices, Number of TIME_WAIT state ports are over 30 thoundans. So I guess It can cause lacks of ports. I want decrese thoses.
Could you comment about this issue please?