-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Ignore spurious PollerCompletionQueue errors in AsyncioExecutor #6492
base: main
Are you sure you want to change the base?
Conversation
@@ -40,6 +41,13 @@ def __init__(self) -> None: | |||
|
|||
@staticmethod | |||
async def _main(loop_future: duet.AwaitableFuture) -> None: | |||
def handle_exception(loop, context) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this function called somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, forgot to actually set this as the exception handler. Fixed.
Note: I filed grpc/grpc#36096 to fix these errors upstream. We'll see what comes of that, but in any case it will be a while before we can rely on that and so I think silencing these errors in our own event loops makes sense. |
@maffoo Is this still something we want to do? Should we close this old PR or push it over the finish line? |
I still think this is nice to have since the error messages look quite scary when printed even though everything is working fine. The error messages only happen when using grpc from multiple threads, which is somewhat niche, but note that this can happen even for users who are not themselves using multiple threads, for example if they use something like a cloud library that itself makes grpc calls in a background thread. If we decide to go ahead I will rebase this to get it up to date with main. |
7cbdc37
to
42c3f02
Compare
When using grpc with asyncio from multiple threads, spurious
PollerCompletionQueue
errors are printed due to multiple event loops listening a socket to be notified of grpc events. More than one event loop may be woken when the completion queue writes a byte to the notification socket, but only one of the loops receives the data and the others raise aBlockingIOError
. This doesn't actually cause a problem in the grpc still works with asyncio in multiple threads, but lots of spurious error messages are printed by the default exception handler. (See grpc/grpc#25364 for discussion of the issue.)This configures the asyncio event loop used for grpc with an exception handler that ignores these
BlockingIOError
s from thePollerCompletionQueue
so that we don't spam the logs with scary-looking messages when using grpc with asyncio from multiple threads.