vmagamedov / grpclib

Pure-Python gRPC implementation for asyncio
http://grpclib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
936 stars 92 forks source link

Receiving an `AttributeError: 'EventsProcessor' object has no attribute 'processors'` #153

Closed BlakeHyde closed 1 year ago

BlakeHyde commented 2 years ago

I'm running 0.4.3rc2 on an M1 Mac, Python 3.10.1, and I receive an error when handling a request:

Fatal error: protocol.data_received() call failed.
protocol: <grpclib.protocol.H2Protocol object at 0x1032af5b0>
transport: <_SelectorSocketTransport closing fd=12 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/Users/blake/.pyenv/versions/3.10.1/lib/python3.10/asyncio/selector_events.py", line 870, in _read_ready__data_received
    self._protocol.data_received(data)
  File "/Users/blake/Library/Caches/pypoetry/virtualenvs/template-service-oVaetOBw-py3.10/lib/python3.10/site-packages/grpclib/protocol.py", line 719, in data_received
    self.processor.process(event)
  File "/Users/blake/Library/Caches/pypoetry/virtualenvs/template-service-oVaetOBw-py3.10/lib/python3.10/site-packages/grpclib/protocol.py", line 564, in process
    proc = self.processors[event.__class__]
AttributeError: 'EventsProcessor' object has no attribute 'processors'
vmagamedov commented 2 years ago

This error happened because data was received after connection (not underlying connection but connection's state in grpclib) was closed (there are many reasons). This kind of error should be a consequence of another error and you probably can find that error in your logs.

Or could you provide more details of what was going on? This was on the client side or on the server-side? This error was raised on server shutdown?

RafRaf commented 1 year ago

I caught the same error. It happens every time I call an RPC with Insomnia.

grpclib==0.4.2

Insomnia Version: Insomnia 2022.6.0 Build date: 9/26/2022 OS: Darwin arm64 21.6.0 Electron: 19.0.3 Node: 16.14.2 V8: 10.2.154.4-electron.0 Architecture: arm64

PS: The interesting thing is that it doesn't affect the result. Everything works perfectly. I accidentally found this in logs

vmagamedov commented 1 year ago

@RafRaf thanks! Was able to reproduce this case. For some reason Insomnia sends GOAWAY frame twice.

Fixed in 00beb4a46af6d604b60b883badc937a39a395db7