Openziti.monkeypatch causes severe slowdown & timeouts with httpx.AsyncClient in async environment

I am facing a performance and timeout problem when using the OpenZiti Python SDK with openziti.monkeypatch() inside an async application.


Environment

  • Python 3.x

  • httpx (async client)

  • OpenZiti Python SDK latest version

  • Running in an async FastAPI app (but reproducible in plain Python async script)

  • Connection works perfectly when NOT using async


Code Example

async with httpx.AsyncClient(timeout=30.0) as client:
    try:
        with openziti.monkeypatch(context=ztx):
            response = await client.post(url, json=payload)


Observed Behavior

:white_check_mark: When using one request:

  • Works fine

  • No timeout

  • Low latency

:cross_mark: When using async/parallel requests:

  • Requests become extremely slow

  • Many calls timeout at 30s

  • CPU usage goes high

  • The slowdown only happens when monkeypatch is active

Expected Behavior

  • openziti.monkeypatch() should work reliably inside async context

  • Multiple concurrent async HTTP calls should not cause blocking / global lock

  • No request should freeze or stall when running in parallel

Request

  • Could you please investigate:

    • Whether the monkeypatch is compatible with httpx.AsyncClient

    • If the monkeypatch creates blocking I/O inside async event loop

    • If there is a known limitation or workaround for async concurrency

    • Whether the Zitified HTTP adapter needs an async-safe implementation