Skip to content

Commit

Permalink
Fix Chrome v124+ not closing on Windows. resolves #1161 (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilike2burnthing committed May 19, 2024
1 parent c304da2 commit 5a2c616
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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 / [email protected])",
"license": "MIT"
Expand Down
1 change: 1 addition & 0 deletions src/flaresolverr_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
1 change: 1 addition & 0 deletions src/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def destroy(self, session_id: str) -> bool:
return False

session = self.sessions.pop(session_id)
session.driver.close()
session.driver.quit()
return True

Expand Down
9 changes: 0 additions & 9 deletions src/undetected_chromedriver/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,15 +788,6 @@ def quit(self):
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")
Expand Down
1 change: 1 addition & 0 deletions src/undetected_chromedriver/devtool.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,5 @@ def wrapped(*args, **kwargs):

time.sleep(10)

driver.close()
driver.quit()
1 change: 1 addition & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

1 comment on commit 5a2c616

@ilike2burnthing
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.