Skip to content

wait_closed not working consistently #107

@twavv

Description

@twavv

I'm not entirely sure what this issue is.

Basically, I have a server.

async def start_server():
    await server.start(...)
    await server.wait_closed()
    print("Closed the server")

elsewhere, I have a function that's triggered when the app has requested a shutdown.

async def shutdown_server():
    server.close()
    await server.wait_closed()
    print("shutdown_server complete")

For some reason, the await server.wait_closed() in start_server never completes, but it does in shutdown_server.

I was able to "fix" this locally by just doing the await server.wait_closed() in a loop with a timeout. Not sure what a minimal reproduction would be. For me, it seems to happen after I've done any gRPC request (it works fine if the shutdown happens before any requests are received, but if the server has handled even unary/unary requests, it doesn't...).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions