Skip to content

Archiving really big mailboxes #10

@DunklerPhoenix

Description

@DunklerPhoenix

Bug Report

  • I have checked that there is no existing issue dealing with this problem.

Summary

It seems that Eonvelope tries to pull all emails from a mailbox at once. This result in a timeout or in an systemexit (maybe because of too much used ressources).

Eonvelope version

0.5.2

Steps to reproduce *

  1. have a really big mailbox (in my case archive with 6.9GB and 200k+ mails)
  2. try to get it once via ALL MAIL creteria
  3. get flooded by system exit and timouts :D

Bug behaviour *

Expected behaviour *

Maybe it would be better to pull mailboxes only in background via worker with multiple tries e.g. 200 mails per call.

Logs *

2026-02-01 15:10:47,604 ERROR - core.utils.fetchers.IMAP4_SSL_Fetcher.__exit__: An error <class 'SystemExit'> occurred exiting Fetcher!
Traceback (most recent call last):
  File "/opt/src/core/models/Mailbox.py", line 177, in test
    fetcher.test(self)
    ~~~~~~~~~~~~^^^^^^
  File "/opt/src/core/utils/fetchers/IMAP4Fetcher.py", line 182, in test
    self.safe_select(utf7_encode(mailbox.name), readonly=True)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/src/core/utils/fetchers/SafeIMAPMixin.py", line 161, in safe_action
    response = imap_action(self, *args, **kwargs)
  File "/opt/src/core/utils/fetchers/SafeIMAPMixin.py", line 208, in safe_select
    return self._mail_client.select(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 861, in select
    typ, dat = self._simple_command(name, mailbox)
               ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1372, in _simple_command
    return self._command_complete(name, self._command(name, *args))
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1174, in _command_complete
    typ, data = self._get_tagged_response(tag, expect_bye=logout)
                ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1315, in _get_tagged_response
    self._get_response()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1217, in _get_response
    resp = self._get_line()
  File "/usr/local/lib/python3.14/imaplib.py", line 1325, in _get_line
    line = self.readline()
  File "/usr/local/lib/python3.14/imaplib.py", line 393, in readline
    buf = self.sock.recv(DEFAULT_BUFFER_SIZE)
  File "/usr/local/lib/python3.14/ssl.py", line 1285, in recv
    return self.read(buflen)
           ~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.14/ssl.py", line 1140, in read
    return self._sslobj.read(len)
           ~~~~~~~~~~~~~~~~~^^^^^
  File "/usr/local/lib/python3.14/site-packages/gunicorn/workers/base.py", line 204, in handle_abort
    sys.exit(1)
    ~~~~~~~~^^^
SystemExit: 1
2026-02-01 15:20:21,167 ERROR - core.utils.fetchers.IMAP4_SSL_Fetcher.__exit__: An error <class 'core.utils.fetchers.exceptions.MailboxError'> occurred exiting Fetcher!
Traceback (most recent call last):
  File "/opt/src/core/utils/fetchers/SafeIMAPMixin.py", line 161, in safe_action
    response = imap_action(self, *args, **kwargs)
  File "/opt/src/core/utils/fetchers/SafeIMAPMixin.py", line 208, in safe_select
    return self._mail_client.select(*args, **kwargs)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 861, in select
    typ, dat = self._simple_command(name, mailbox)
               ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1372, in _simple_command
    return self._command_complete(name, self._command(name, *args))
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1174, in _command_complete
    typ, data = self._get_tagged_response(tag, expect_bye=logout)
                ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1315, in _get_tagged_response
    self._get_response()
    ~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.14/imaplib.py", line 1217, in _get_response
    resp = self._get_line()
  File "/usr/local/lib/python3.14/imaplib.py", line 1325, in _get_line
    line = self.readline()
  File "/usr/local/lib/python3.14/imaplib.py", line 393, in readline
    buf = self.sock.recv(DEFAULT_BUFFER_SIZE)
  File "/usr/local/lib/python3.14/ssl.py", line 1285, in recv
    return self.read(buflen)
           ~~~~~~~~~^^^^^^^^
  File "/usr/local/lib/python3.14/ssl.py", line 1140, in read
    return self._sslobj.read(len)
           ~~~~~~~~~~~~~~~~~^^^^^
TimeoutError: The read operation timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/src/core/models/Mailbox.py", line 177, in test
    fetcher.test(self)
    ~~~~~~~~~~~~^^^^^^
  File "/opt/src/core/utils/fetchers/IMAP4Fetcher.py", line 182, in test
    self.safe_select(utf7_encode(mailbox.name), readonly=True)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/src/core/utils/fetchers/SafeIMAPMixin.py", line 168, in safe_action
    raise exception_class(error, imap_action.__name__) from error
core.utils.fetchers.exceptions.MailboxError: Ein TimeoutError: The read operation timed out trat während safe_select im Postfach auf!

Screenshots

Files/Emails

Possible diagnosis

Fix it yourself?

EDIT: Sry for that edge case ^^'

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingconfirmedThis issues content has been confirmedfeature requestA proposal for a new feature

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions