Fix Chrome v124+ not closing on Windows. resolves #1161 (#1193)

This commit is contained in:
ilike2burnthing 2024-05-20 00:52:55 +01:00 committed by GitHub
parent c304da2964
commit 5a2c61601e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 15 additions and 15 deletions

View File

@ -1,5 +1,10 @@
# Changelog
## v3.3.18 (2024/05/20)
* Fix LANG ENV for Linux
* Fix Chrome v124+ not closing on Windows. Thanks @RileyXX
## v3.3.17 (2024/04/09)
* Fix file descriptor leak in service on quit(). Thanks @zkulis

View File

@ -62,17 +62,17 @@ ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["/usr/local/bin/python", "-u", "/app/flaresolverr.py"]
# Local build
# docker build -t ngosang/flaresolverr:3.3.17 .
# docker run -p 8191:8191 ngosang/flaresolverr:3.3.17
# docker build -t ngosang/flaresolverr:3.3.18 .
# docker run -p 8191:8191 ngosang/flaresolverr:3.3.18
# Multi-arch build
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# docker buildx create --use
# docker buildx build -t ngosang/flaresolverr:3.3.17 --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 .
# docker buildx build -t ngosang/flaresolverr:3.3.18 --platform linux/386,linux/amd64,linux/arm/v7,linux/arm64/v8 .
# add --push to publish in DockerHub
# Test multi-arch build
# docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
# docker buildx create --use
# docker buildx build -t ngosang/flaresolverr:3.3.17 --platform linux/arm/v7 --load .
# docker run -p 8191:8191 --platform linux/arm/v7 ngosang/flaresolverr:3.3.17
# docker buildx build -t ngosang/flaresolverr:3.3.18 --platform linux/arm/v7 --load .
# docker run -p 8191:8191 --platform linux/arm/v7 ngosang/flaresolverr:3.3.18

View File

@ -1,6 +1,6 @@
{
"name": "flaresolverr",
"version": "3.3.17",
"version": "3.3.18",
"description": "Proxy server to bypass Cloudflare protection",
"author": "Diego Heras (ngosang / ngosang@hotmail.es)",
"license": "MIT"

View File

@ -245,6 +245,7 @@ def _resolve_challenge(req: V1RequestBase, method: str) -> ChallengeResolutionT:
raise Exception('Error solving the challenge. ' + str(e).replace('\n', '\\n'))
finally:
if not req.session and driver is not None:
driver.close()
driver.quit()
logging.debug('A used instance of webdriver has been destroyed')

View File

@ -66,6 +66,7 @@ class SessionsStorage:
return False
session = self.sessions.pop(session_id)
session.driver.close()
session.driver.quit()
return True

View File

@ -788,15 +788,6 @@ class Chrome(selenium.webdriver.chrome.webdriver.WebDriver):
logger.debug("gracefully closed browser")
except Exception as e: # noqa
pass
# Force kill Chrome process in Windows
# https://github.com/FlareSolverr/FlareSolverr/issues/772
if os.name == 'nt':
try:
subprocess.call(['taskkill', '/f', '/pid', str(self.browser_pid)],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except Exception:
pass
if (
hasattr(self, "keep_user_data_dir")
and hasattr(self, "user_data_dir")

View File

@ -187,4 +187,5 @@ def test():
time.sleep(10)
driver.close()
driver.quit()

View File

@ -314,6 +314,7 @@ def get_user_agent(driver=None) -> str:
raise Exception("Error getting browser User-Agent. " + str(e))
finally:
if driver is not None:
driver.close()
driver.quit()