bamthomas / aioimaplib

Python asyncio IMAP4rev1 client library
GNU General Public License v3.0
133 stars 59 forks source link

Failure parsing valid response when working with multiple clients #106

Open kosty opened 3 months ago

kosty commented 3 months ago

My setup is somewhat strange, I have two different clients periodically polling same folder for messages from two different senders. Both clients are instantiated inside the same process. When email arrives from either of the senders this shows up in logs. Removing either of clients makes the error go away

2024-06-28 12:18:16,546 [ERROR] [/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py:1821] [default_exception_handler] Fatal error on SSL protocol
protocol: <asyncio.sslproto.SSLProtocol object at 0x105f19fa0>
transport: <_SelectorSocketTransport closing fd=11 read=idle write=<idle, bufsize=0>>
Traceback (most recent call last):
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/sslproto.py", line 737, in _do_read
    self._do_read__copied()
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/sslproto.py", line 797, in _do_read__copied
    self._app_protocol.data_received(first)
  File "/path/to/venv/lib/python3.12/site-packages/aioimaplib/aioimaplib.py", line 346, in data_received
    self._handle_responses(self.incomplete_line + d, self._handle_line, self.current_command)
  File "/path/to/venv/lib/python3.12/site-packages/aioimaplib/aioimaplib.py", line 387, in _handle_responses
    self._handle_responses(tail, line_handler)
  File "/path/to/venv/lib/python3.12/site-packages/aioimaplib/aioimaplib.py", line 375, in _handle_responses
    cmd = line_handler(line, current_cmd)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/venv/lib/python3.12/site-packages/aioimaplib/aioimaplib.py", line 398, in _handle_line
    self._response_done(line)
  File "/path/to/venv/lib/python3.12/site-packages/aioimaplib/aioimaplib.py", line 667, in _response_done
    raise Abort('unexpected tagged (%s) response: %s' % (tag, response))
aioimaplib.aioimaplib.Abort: unexpected tagged (b'CJBF4') response: b'OK SEARCH completed (Success)'