Skip to content

CDP Timeout Error #3759

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

Closed
breadacker opened this issue May 20, 2025 · 1 comment
Closed

CDP Timeout Error #3759

breadacker opened this issue May 20, 2025 · 1 comment
Labels
can't reproduce We tried to see what you saw, but didn't invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode

Comments

@breadacker
Copy link

I have been running the following code for almost 3 days successfully, but today I got this error which I couldnt resolve?

with SB(uc=True, headless2=headless, maximize=True, incognito=True, do_not_track=True, ad_block=True) as sb:
# Open the main page once
sb.activate_cdp_mode(url)
sb.sleep(10)

Traceback (most recent call last):
sb.activate_cdp_mode(url)
File "base_case.py", line 4841, in activate_cdp_mode
self.driver.uc_open_with_cdp_mode(url)
File "browser_launcher.py", line 5338, in
lambda *args, **kwargs: uc_open_with_cdp_mode(
File "browser_launcher.py", line 599, in uc_open_with_cdp_mode
page = loop.run_until_complete(driver.cdp_base.get(url))
File "asyncio/base_events.py", line 653, in run_until_complete
return future.result()
File "browser.py", line 288, in get
frame_id, loader_id, *_ = await connection.send(
File "connection.py", line 396, in send
await self.aopen()
File "connection.py", line 267, in aopen
self.websocket = await websockets.connect(
File "asyncio/client.py", line 478, in await_impl
raise TimeoutError("timed out during handshake") from None

TimeoutError: timed out during handshake

@mdmintz mdmintz added invalid usage You may need to change what you're doing can't reproduce We tried to see what you saw, but didn't UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode not enough info not enough info / more info needed labels May 20, 2025
@mdmintz
Copy link
Member

mdmintz commented May 20, 2025

Given that you ran it for 3 days successfully and then it crashed, it's possible that you ran out of memory somehow, but I can't reproduce your issue. I would try adding in some form of automated cleanup. It's also possible you ran too many threads at the same time. Newer versions of Python have improved asyncio. (Not sure which version you were running, if you were running multiple threads, or how many threads at the same time you ran.)

Also some of your options are contradictory. You set Incognito Mode, but that doesn't allow you to set Chrome extensions, which is how the ad_block functionality works. You also don't need headless mode because there's Xvfb, which lets you run a regular Chrome browser on a Linux machine that has no display.

@mdmintz mdmintz closed this as completed May 20, 2025
@mdmintz mdmintz removed the not enough info not enough info / more info needed label May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
can't reproduce We tried to see what you saw, but didn't invalid usage You may need to change what you're doing UC Mode / CDP Mode Undetected Chromedriver Mode / CDP Mode
Projects
None yet
Development

No branches or pull requests

2 participants