Skip to content

Performance decrease with multiple contexts #160

Description

@curvah

Hi guys, when running N (from my tests 4 is enough to replicate) threads using a single shared Browser instance with one BrowserContext per thread, the turnstile challenge take significantly longer to resolve (or stall indefinitely) compared to spawning a dedicated Browser instance per task.

This is how I was creating the browser and the context (pretty straightforward):

browser = await launch_async(
        headless=False,
        geoip=False,
        humanize=True,
)
context = await browser.new_context(proxy={"server": "...", "username": "...", "password": "..."})

I tested the same script but creating one browser per task instead of using contexts and the results where as expected, each task managed to solve the challenge without any problem, but I had to use geoip=True (that I can't when using contexts).

Using VNC to see why its taking much to solve seems like that cloudflare is detecting something or something is not going as it should be (the "Stuck?" warning is a sign that is taking too much to load the challenge):
Image

I am running this on docker with xvfb and the cloakbrowser version is 146.0.7680.177.3

Is this expected behavior, or does it point to a bug in context isolation?
Im always open to test more if needed, thanks in advance for any help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions