Skip to content

Connection Lost makes infinite blocking #41

@holyachon

Description

@holyachon

Hello. I got lambda timeout in AWS Lambda environment.

I set max_connections=10, and logs at the end are below.

Closing connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80ee74a10>
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80ee74a10> lost! Error: None
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80ee74a10> discarded
Connection released (total: 3)
Closing connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c331310>
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c331310> lost! Error: None
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c331310> discarded
Connection released (total: 2)
Closing connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80e2a8510>
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80e2a8510> lost! Error: None
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80e2a8510> discarded
Connection released (total: 1)
Closing connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c076750>
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c076750> lost! Error: None
Connection <aioapns.connection.APNsProductionClientProtocol object at 0x7fa80c076750> discarded
Connection released (total: 0)

I think when connection is lost, new connection is not created and it blocks infinite.

In my local environment (M1 Macbook), another exception shown but it is just skipped and works well.

Connection <aioapns.connection.APNsProductionClientProtocol object at 0x10dde3048> terminated: code=ErrorCodes.NO_ERROR, additional_data=b'{"reason":"BadDeviceToken"}', last_stream_id=279
Invalid input ConnectionInputs.RECV_RST_STREAM in state ConnectionState.CLOSED
Traceback (most recent call last):
  File ".../lib/python3.7/site-packages/h2/connection.py", line 224, in process_input
    func, target_state = self._transitions[(self.state, input_)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.RECV_RST_STREAM: 16>)
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sym/.pyenv/versions/3.7.16/lib/python3.7/asyncio/sslproto.py", line 545, in data_received
    self._app_protocol.data_received(chunk)
  File ".../python3.7/site-packages/aioapns/connection.py", line 82, in data_received
    for event in self.conn.receive_data(data):
  File ".../python3.7/site-packages/h2/connection.py", line 1463, in receive_data
    events.extend(self._receive_frame(frame))
  File ".../python3.7/site-packages/h2/connection.py", line 1486, in _receive_frame
    frames, events = self._frame_dispatch_table[frame.__class__](frame)
  File ".../python3.7/site-packages/h2/connection.py", line 1786, in _receive_rst_stream_frame
    ConnectionInputs.RECV_RST_STREAM
  File ".../python3.7/site-packages/h2/connection.py", line 229, in process_input
    "Invalid input %s in state %s" % (input_, old_state)
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.RECV_RST_STREAM in state ConnectionState.CLOSED

I think python-hyper/h2#1199 issue is related with it.
Do you have any idea about this? Thank you in advance.

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