Skip to content
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

wait_closed not working consistently #107

Open
twavv opened this issue May 3, 2020 · 1 comment
Open

wait_closed not working consistently #107

twavv opened this issue May 3, 2020 · 1 comment

Comments

@twavv
Copy link

twavv commented May 3, 2020

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...).

@vmagamedov
Copy link
Owner

This is a known issue, it is related to python-hyper/h2#1181.

Currently grpclib cancels all current requests and waits until they finish. But when new requests come this don't works as expected.

What should be done: grpclib should send GOAWAY frame and complete all current requests. GOAWAY makes it possible to stop new requests coming. But currently sending GOAWAY frame is almost equal to immediately closing an entire connection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants