Skip to content

Multiple requests to test clients cause RecursionError #81

Description

@matejscerba

Too large number of requests to Sanic test clients (regular and ASGI) causes RecursionError: maximum recursion depth exceeded.

Both of the following tests raise RecursionError when triggered. app is a fixture providing Sanic app with TestManager initialized according to documentation (https://sanic.dev/en/plugins/sanic-testing/clients.html).

The cause of this is indefinite expansion of Sanic signals routes in Sanic.signal_router as mentioned in #76 (comment)

@pytest.mark.asyncio(loop_scope="session")
async def test_sanic_asgi_recursion(app):
    for _ in range(1000):
        await app.asgi_client.get("/live")


def test_sanic_test_recursion(app):
    for _ in range(1000):
        app.test_client.get("/live")

I am using:

  • Python 3.13
  • Sanic 25.3.0
  • Sanic testing 24.6.0
  • Sanic routing 23.12.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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