-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCP socket remains after chrome is quitted #1025
Comments
Setting keep_alive to False, would fix the problem self.driver = uc.Chrome (options=options, driver_executable_path=executable_path, enable_cdp_events=True, keep_alive=False) Well not because it closes connection but because connection goes to TIME_WAIT, which then will timeout after few seconds according to your windows TCP configuration. |
Why not try:.. while True:
driver = uc.Chrome()
driver.get("google.com")
time.sleep(10)
driver.quit() No options required as its all included |
Well I tried to call gc collector, and it doesn't still help. The initial connections running is much more than 2, so I don't think gc has to do anything with this case, because otherwise it'd have not closed the rest as well DURING Runtime: netstat -ano | find "185.151.247.141"
TCP 192.168.1.31:10350 185.151.247.141:14432 ESTABLISHED 21648
TCP 192.168.1.31:10351 185.151.247.141:14432 ESTABLISHED 21648
TCP 192.168.1.31:10366 185.151.247.141:14432 TIME_WAIT 0
TCP 192.168.1.31:10368 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10369 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10372 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10373 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10374 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10375 185.151.247.141:14432 CLOSE_WAIT 16012
TCP 192.168.1.31:10376 185.151.247.141:14432 CLOSE_WAIT 16012
TCP 192.168.1.31:10379 185.151.247.141:14432 CLOSE_WAIT 16012
TCP 192.168.1.31:10380 185.151.247.141:14432 CLOSE_WAIT 16012
TCP 192.168.1.31:10382 185.151.247.141:14432 CLOSE_WAIT 16012
TCP 192.168.1.31:10383 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10384 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10385 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10386 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10392 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10393 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10394 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10395 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10396 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10399 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10400 185.151.247.141:14432 ESTABLISHED 16012
TCP 192.168.1.31:10401 185.151.247.141:14432 ESTABLISHED 16012 The result would have been same without those options. EDIT: you put sleep before quitting, the case here is that connections are supposed to be closed with the driver. so it makes sense if you put sleep after quit. |
I have fixed this issue in my own PR #1031 |
Hello, ever since using python 3.11 with UC v3.2.1, I have an issue where socket doesn't close after chrome is quitted. so I created a test enviroment
Running with proxy --> 185.151.247.141
after .quit is called, during sleeping time there should be no TCP connection alive
and sometimes it'd be CLOSE_WAIT.
Any reason why?
I think a socket is made in cdp method that has not closed, which caused this, but I couldn't find it.
After few hours of running, all ports get occupied by program, and then it allows no TCP connection which will break everything.
The text was updated successfully, but these errors were encountered: