imaplib2 icon indicating copy to clipboard operation
imaplib2 copied to clipboard

connection to IMAP-SSL host fails on armhf

Open st31ny opened this issue 7 years ago • 4 comments

I already submitted this bug to the Debian bugtracker (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=899102).

Apparently, connection to an IMAP host fails on at least armhf platforms (such as Raspberry Pi):

>>> import imaplib2
>>> c=imaplib2.IMAP4('imap.strato.de')
  26:45.17 imap.strato.de reader last 20 log messages:
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 400, in __init__
    self.welcome = self._request_push(name='welcome', tag='continuation').get_response('IMAP4 protocol error: %s')[1]
TypeError: 'NoneType' object is not subscriptable

The same sequence of commands works like a charm on amd64. I tested both, 2.55 and 2.57.

Thank you for your help!

st31ny avatar May 27 '18 18:05 st31ny

I think you have the same problem as I with i386 (see the other open issue). As far as I can tell, imaplib2 currently only works on amd64. Also, the project seems to be abandoned - I have had no response since I reported it quite some time ago...

tari01 avatar May 27 '18 18:05 tari01

True, this seems to be related… What a pity — is there a chance to find the bug ourselves in reasonable time?

st31ny avatar May 28 '18 15:05 st31ny

Project not abandoned happy to accept PR with testcase

graingert avatar May 28 '18 15:05 graingert

Great to hear that!

Well, I tried to dig a bit into the code. When I enable debugging, I get this:

>>> c=imaplib2.IMAP4('imap.strato.de')
starting
starting using poll
_request_push(continuation, welcome, {}) = LBHN0
welcome:LBHN0.ready.wait
_close_threads
finished
call shutdown
poll => [(3, 17)]
  42:38.04 imap.strato.de reader last 20 log messages:
socket error:  - [Errno 9] Bad file descriptor
finished
starting
terminating: 'Terminated'
welcome:LBHN0.ready.set
state_change_free.set
finished
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3/dist-packages/imaplib2.py", line 400, in __init__
    self.welcome = self._request_push(name='welcome', tag='continuation').get_response('IMAP4 protocol error: %s')[1]
TypeError: 'NoneType' object is not subscriptable

So, there seems to be a bad file descriptor involved. I hope this helps.

EDIT: I am actually seeing two different exception. Sometimes the poll() call signals an error condition of POLLNVAL (https://github.com/imaplib2/imaplib2/blob/master/imaplib2/imaplib2.py3#L1856), sometimes, reading the socket fails (https://github.com/imaplib2/imaplib2/blob/master/imaplib2/imaplib2.py3#L527)

st31ny avatar May 28 '18 15:05 st31ny