Skip to content
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

command: FETCH => socket error: <class 'OSError'> - Too many read 0 #726 #138

Open
alexmihajlov opened this issue Nov 11, 2022 · 3 comments

Comments

@alexmihajlov
Copy link

General informations

  • system/distribution (with version): OpenBSD 7.2
  • offlineimap version (offlineimap -V): offlineimap v8.0.0, imaplib2 v3.06, Python v3.9.15, LibreSSL 3.6.0
  • Python version: Python v3.9.15
  • server name or domain: N/A
  • CLI options:

Configuration file offlineimaprc

[general]
ui = basic
accounts = MyExchangeServer
fsync = false
maxsyncaccounts = 1
singlethreadperfolder = false
holdconnectionopen = yes
ssl_version = StartTLS
usecompression = yes
keepalive = 60

[Account MyExchangeServer]
localrepository = MyExchangeServer-Local
remoterepository = MyExchangeServer-Remote
autorefresh = 0.5
quick = 10
utf8foldernames = yes

[Repository MyExchangeServer-Local]
type = Maildir
localfolders = ~/.Mail/MyExchangeServer

[Repository MyExchangeServer-Remote]
type = IMAP
remotehost = mail.myserver.org
remoteport = 993
remoteuser = user
remotepass = pass
realdelete = no
maxconnections = 1
ssl = yes
sslcacertfile = /etc/ssl/cert.pem
keepalive = 6
auth_mechanisms = PLAIN, LOGIN

pythonfile (if any)

N/A

Logs, error

Establishing connection to mail.myserver.org:993 (MyExchangeServer-Remote)
Syncing outages: IMAP -> Maildir
Syncing removal: IMAP -> Maildir
Syncing Remstats: IMAP -> Maildir
ERROR: ERROR in syncfolder for MyExchangeServer folder Remstats: Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/offlineimap/accounts.py", line 653, in syncfolder
    remotefolder.cachemessagelist()
  File "/usr/local/lib/python3.9/site-packages/offlineimap/folder/IMAP.py", line 299, in cachemessagelist
    res_type, response = imapobj.fetch(
  File "/usr/local/lib/python3.9/site-packages/imaplib2/imaplib2.py", line 828, in fetch
    return self._simple_command(name, message_set, message_parts, **kw)
  File "/usr/local/lib/python3.9/site-packages/imaplib2/imaplib2.py", line 1705, in _simple_command
    return self._command_complete(self._command(name, *args), kw)
  File "/usr/local/lib/python3.9/site-packages/imaplib2/imaplib2.py", line 1449, in _command_complete
    typ, dat = rqb.get_response('command: %s => %%s' % rqb.name)
  File "/usr/local/lib/python3.9/site-packages/imaplib2/imaplib2.py", line 212, in get_response
    raise typ(exc_fmt % str(val))
imaplib2.imaplib2.IMAP4.abort: command: FETCH => socket error: <class 'OSError'> - Too many read 0

  command: FETCH => socket error: <class 'OSError'> - Too many read 0
Syncing root mail: IMAP -> Maildir

Steps to reproduce the error

trying to get mail from a mailbox with 25,000 emails

@rmunn
Copy link

rmunn commented Jan 30, 2024

I've been encountering this one too. It seems to correlate with folder size: the larger the folder, the more often it happens. While syncing my entire Gmail account, including the All Mail folder (I'm aware this will create duplicate mails, and I'm fine with that), I encountered this error about once in every 3000 emails while syncing other folders that had 15000 (15K) emails in them. While syncing the All Mail folder that had 150000 (150K) emails in it, this error seemed to happen every 100 emails or so.

Then I found a message from 13 years ago on the offlineimap-project mailing list, which asked whether compression was turned on. I checked, and in my case, it was. I changed usecompression = yes to usecompression = no in my config file, and the error appears to have gone away: the All Mail folder has downloaded over 2000 messages so far with no "Too many read 0" errors.

@rmunn
Copy link

rmunn commented Feb 1, 2024

I just got a "Too many read 0" error even with usecompression = no, on the 15842nd message (out of 159938) I downloaded from All Mail. (Total time elapsed: 72 minutes 12 seconds). So they are still possible with compression turned off, just much, MUCH rarer.

@rmunn
Copy link

rmunn commented Feb 1, 2024

And it happened again after copying 40361 messages; the 40362nd message got "Too many read 0". So it's random, but only a minor annoyance; I can just run until offlineimap; do sleep 1; done and it will eventually complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants