Free-tier session never releases after abrupt process exit — every subsequent launch fails silently with "Target page, context or browser has been closed" (any site, headless or headed)
Description:
After one abrupt/non-clean shutdown (browser killed mid-run, script crashed, terminal
closed while a script was paused at input()) instead of a clean browser.close(), my
free-tier license got permanently stuck showing "1 seat in use" via cloakbrowser info
— even though zero CloakBrowser processes are running anywhere on the machine.
From that point on, every single launch() call fails identically: the browser opens (is_connected() == True for ~1-2s), then the very first page.goto() throws "Target page, context or browser has been closed". This happens on ANY url, including https://example.com — not specific to any target site. No error text is printed anywhere (stdout/stderr/Windows Event Log) explaining why — it's a completely silent failure, consistent with the documented behavior in license.py that license-denial exit codes intentionally print no diagnostic string.
Expected: either the session should self-release faster, or launch() should raise a clear CloakBrowserLicenseError (like it does for other license failures at launch-time) instead of returning a Browser object that dies on first use with a generic Playwright error.
CloakBrowser version: 0.5.3 (wrapper), Chromium 150.0.7871.114.3 (pro binary, free tier)
Wrapper: Python 3.13.5
Environment: Windows 11 Home (10.0.26200), x86_64, not Docker. Binary at C:\Users<user>.cloakbrowser\chromium-150.0.7871.114.3-pro\chrome.exe
Launch options:
launch(headless=False, humanize=True, human_preset="careful", license_key=,
stealth_args=True)
— also independently tested and failed identically with: headless=True,
stealth_args=False, humanize=False, no extra args, and with license_key omitted
entirely (falls back to same cached binary). Also reproduced launching the raw
chrome.exe binary directly (bypassing Playwright/the Python wrapper entirely) with
--remote-debugging-port — DevTools opens ("DevTools listening on ws://...") and the
process still exits within ~5s with no further output besides one harmless
net\cert\ev_root_ca_metadata.cc warning.
Tested with a different IP or proxy? No — this reproduces on the plain host network, and the failure isn't network/site-specific (fails on example.com too), so this wasn't pursued further.
Works outside Docker / on host machine? Not using Docker — this is on host machine only.
Steps to reproduce:
- Have a valid free-tier license key with 1 concurrent session allowed.
- Run several launch() calls in succession during normal dev/testing iteration, at least one of which is interrupted abruptly (Ctrl+C, crashed script, closed terminal) rather than reaching browser.close().
- Run
python -m cloakbrowser info— note "Sessions: 1 seat in use" despite no local process running. - Any subsequent launch() + goto() now fails with TargetClosedError, indefinitely, until the session times out or is cleared server-side.
Error output: Launched OK. is_connected: True Context created. Page created. is_closed: False Navigating... playwright._impl._errors.TargetClosedError: Page.goto: Target page, context or browser has been closed Call log:
- navigating to "https://example.com/", waiting until "load"
Dockerfile (if applicable): N/A, not using Docker.
Additional notes: Before concluding this was a stuck session, I ruled out every other explanation I could check on this machine:
- Windows Defender: no threat detections near the crash times
- Defender Attack Surface Reduction rules: not even enabled on this machine
- AppLocker: nothing relevant logged
- SmartScreen: empty operational log
- Application crash events / crash dump files: none — it's exiting clean, not crashing
- validate_license(key) returns valid=True, plan='free'
- ~/.cloakbrowser config dir: writable, confirmed
- Network reachability to https://cloakbrowser.dev/api/license/validate: reachable (405 on GET, as expected for a POST-only endpoint)
- A completely separate SeleniumBase/undetected_chromedriver Chrome instance launches and navigates fine on this same machine at the same time, so it's not a system-wide/Chrome-wide problem.
The only client-facing function related to sessions in the installed package is the
read-only get_active_session_count(key) in cloakbrowser.license — there's no
release_session()/end_session() exposed anywhere to clear this from the client side.
Would appreciate either: (a) a documented way to force-release a stuck session client-side, (b) a shorter server-side timeout for abandoned sessions, or (c) launch() raising CloakBrowserLicenseError immediately in this case instead of a silent downstream Playwright error.
Source: CloakHQ/CloakBrowser