Hang up reading Yandex mail box listing.

Viacheslav Chimishuk <[email protected]>
Newsgroups gmane.mail.getmail.user
Message-ID <[email protected]>
Hi, guys.

I'm using getmail on my Archlinux machine. Latest version -- 5.13. I
have a few mail boxes configured: Gmail and Yandex.Mail [1]. Gmail
works fine but Yandex sometime causes Getmail hang up. It happens
pretty often: every 1-3 days (getmail runs every 3 minutes by systemd
timer). During my experiments I've found the place where mail box
retrieval process stops.

Python process keeps running:
$ ps aux | grep getmail
24207 ?        S      0:08 python2 -u /bin/getmail --rcfile rc.vchimishuk --rcfile rc.geomotiv --rcfile rc.viacheslav88

Network connection is still alive:
$ netstat -tnlp | grep 24207
tcp        0      0 192.168.2.100:37432     213.180.204.212:995     ESTABLISHED 24207/python2

Here is a stack trace:
  File "/bin/getmail", line 934, in <module>
    main()
  File "/bin/getmail", line 898, in main
    success = go(configs, options.idle)
  File "/bin/getmail", line 166, in go
    retriever.select_mailbox(mailbox)
  File "/usr/lib/python2.7/site-packages/getmailcore/_retrieverbases.py", line 1046, in select_mailbox
    self._getmsglist()
  File "/usr/lib/python2.7/site-packages/getmailcore/_retrieverbases.py", line 1057, in _getmsglist
    (response, msglist, octets) = self.conn.uidl()
  File "/usr/lib/python2.7/poplib.py", line 323, in uidl
    return self._longcmd('UIDL')
  File "/usr/lib/python2.7/poplib.py", line 172, in _longcmd
    return self._getlongresp()
  File "/usr/lib/python2.7/poplib.py", line 155, in _getlongresp
    line, o = self._getline()
  File "/usr/lib/python2.7/poplib.py", line 381, in _getline
    self._fillBuffer()
  File "/usr/lib/python2.7/poplib.py", line 371, in _fillBuffer
    localbuf = self.sslobj.read()
  File "/usr/lib/python2.7/ssl.py", line 659, in read
    v = self._sslobj.read(len)
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <module>

Line numbers in stack trace may not be very accurate, I've added some
print statements to print some debug messages.

What I can see from my debug next process happens:
1. getmail sends UIDL command
2. server responds with next line
   +OK 91173 1809030538
3. getmail reads next lines until "." will be returned
   1 169447935979906567
   2 169447935979906566
   3 169447935979906565
   4 169447935979906564
   ...
   35393 161566636631953045
   35394 161566636631953042
   35395 161566636631953025
   // No more lines read. No "."
4. POP3 server stops producing any data, getmail blocks inside read()
   call.

AFAIU, TCP connection is not closed correctly by server (?) and
remains open. I saw it blocked for more then a day.
Maybe we can fix it by setting read timeout for a socket? What do you
think about the situation?

[1] https://mail.yandex.ru/

--
Best regards, Viacheslav Chimishuk
[email protected]
Ukraine, Khmelnitsky
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.