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

Too many read 0, while fetching msg '214' #292

Closed
silasdb opened this issue Jan 7, 2016 · 14 comments
Closed

Too many read 0, while fetching msg '214' #292

silasdb opened this issue Jan 7, 2016 · 14 comments

Comments

@silasdb
Copy link

silasdb commented Jan 7, 2016

Hi there! In another list.remote(x) bug report (#198), you told me that the problem I reported was due to poor error handling and wasn't related to the other problem handled there. You then asked me to open a new issue. Here we go. Debug output is attached. Thanks!

debug.txt

@nicolas33
Copy link
Member

Which version?

@silasdb
Copy link
Author

silasdb commented Jan 7, 2016

6.5.6, under NetBSD 7.0.

@nicolas33
Copy link
Member

Please, try latest stable.

@silasdb
Copy link
Author

silasdb commented Jan 9, 2016

In latest stable (6.6.1) list.remove(x): x not in list disappears but Too many read 0 still shows up. (debug2.txt attached).

I had a filesystem crash and if I delete the entire folder and download everything again it works, but I believe OfflineIMAP was supposed to handle this or provide more useful error messages?

Thanks!

debug2.txt

@nicolas33
Copy link
Member

ERROR: command: UID => socket error: <type 'exceptions.IOError'> - Too many read 0, while fetching msg '214' in folder 'INBOX.datacenter'. Max retry reached (2)

This Max retry reached (2) explains why it failed. This error should not be reproducible unless there is a lot of changes in this folder.

@nicolas33 nicolas33 changed the title list.remove(x): x not in list due to poor error handling max retries reached Jan 9, 2016
@silasdb
Copy link
Author

silasdb commented Jan 10, 2016

Hi again! Thanks! I found and deleted problematic messages using the webmail. Isn't strange, though, that they "appeared" there? Is there any chance that offlineimap have pushed zero size or corrupted messages? Thanks!

@nicolas33
Copy link
Member

Yes, that's possible. We can't tell without samples to retry.

@dolohow
Copy link
Member

dolohow commented Jun 10, 2016

Exactly the same same error happens on some mails when using Python 3, yet offlineimap under Python 2 works like a charm.

ERROR: command: UID => socket error: <class 'OSError'> - Too many read 0, while fetching msg '4105' in folder 'INBOX' . Max retry reached (2)

Looks like a socket cannot be polled in bundled_imaplib2.py:1842 and it retries infinitely, but what causes that I have no idea.

while not (terminate or self.Terminate):                                                                              
    if self.state == LOGOUT:                                                                                          
        timeout = 10                                                                                                  
    else:                                                                                                             
        timeout = read_poll_timeout                                                                                   
    try:                                                                                                              
        r = poll.poll(timeout)                                                                                        
        if __debug__: self._log(5, 'poll => %s' % repr(r))                                                            
        if not r:                                                                                                     
            continue                                    # Timeout

EDIT: Could be some encoding issue?

@nicolas33 nicolas33 changed the title max retries reached Too many read 0, while fetching msg '214' Jun 10, 2016
@nicolas33
Copy link
Member

I wonder that with Py3 the reader makes excessive reads while the full email got already downloaded if the recorded size of what was downloaded is wrongly too low. IOW, the email is already fully downloaded but the client didn't count the bytes correctly so it tries to read more data.

This is just an idea that could really be wrong.

@nicolas33
Copy link
Member

Additional note: this could happen because str type was changed in Py3. I expect the correct type must be bytes.

@purpleidea
Copy link

I hit this issue on a F28 machine. It ran for a while, and then all of a sudden it now dies after a few minutes.

offlineimap --version
7.1.5
Thread 'Copy message from XXX@gmail.com-Remote:[Gmail]/All Mail' terminated with exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/offlineimap/threadutil.py", line 160, in run
    Thread.run(self)
  File "/usr/lib64/python2.7/threading.py", line 757, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.py", line 287, in copymessageto
    super(GmailFolder, self).copymessageto(uid, dstfolder, statusfolder, register)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Base.py", line 839, in copymessageto
    message = self.getmessage(uid)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/Gmail.py", line 72, in getmessage
    data = self._fetch_from_imap(str(uid), self.retrycount)
  File "/usr/lib/python2.7/site-packages/offlineimap/folder/IMAP.py", line 784, in _fetch_from_imap
    imapobj.select(self.getfullIMAPname(), readonly=True)
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line 64, in select
    exc_info()[2])
  File "/usr/lib/python2.7/site-packages/offlineimap/imaplibutil.py", line 53, in select
    result = super(UsefulIMAPMixIn, self).select(mailbox, readonly)
  File "/usr/lib/python2.7/site-packages/offlineimap/bundled_imaplib2.py", line 1098, in select
    typ, dat = rqb.get_response('command: %s => %%s' % rqb.name)
  File "/usr/lib/python2.7/site-packages/offlineimap/bundled_imaplib2.py", line 201, in get_response
    raise typ(exc_fmt % str(val))
OfflineImapError: Server 'imap.gmail.com' closed connection, error on SELECT '[Gmail]/All Mail'. Server said: command: EXAMINE => socket error: <type 'exceptions.IOError'> - Too many read 0

@nicolas33
Copy link
Member

@purcell open a new issue, please. You're running on python2.

@purcell
Copy link
Contributor

purcell commented Apr 24, 2019

@nicolas33 I think you meant to tag @purpleidea, not me. :-)

@thekix
Copy link
Contributor

thekix commented Oct 27, 2020

Hello,

I think this bug could be closed. If you run offlineimap with Python2 this error should not happen. If you run Python3, please, use offlineimap3.

Regards,
kix

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

No branches or pull requests

6 participants