Bug 2416 - spin loop checking pop3
Summary: spin loop checking pop3
Status: RESOLVED DUPLICATE of bug 3139
Alias: None
Product: Claws Mail (GTK 2)
Classification: Unclassified
Component: POP3 (show other bugs)
Version: 3.7.8
Hardware: PC Linux
: P3 major
Assignee: users
URL:
Depends on:
Blocks:
 
Reported: 2011-05-02 18:21 UTC by Robert
Modified: 2014-05-22 19:47 UTC (History)
2 users (show)

See Also:


Attachments

Description Robert 2011-05-02 18:21:28 UTC
My companies mail system is having troubles this weekend with it's authentication backend. It looks like it is hanging after PASS is sent. After this, claws goes into a tight spin loop from which it does not recover. My cpu usage spikes, and claws becomes completely unresponsive.

last few lines in the log:

[08:08:21] * message: Connecting to POP3 server: mail.XXX.com....
[08:08:22] POP3< +OK Microsoft Exchange Server 2003 POP3 server version 6.5.7638.1 (mail.XXX.com) ready.
[08:08:22] POP3> USER rs
[08:08:22] POP3< +OK
[08:08:22] POP3> PASS ********

I attached strace to the pid, and see this repeated over and over:

select(21, [20], NULL, NULL, {0, 0})    = 1 (in [20], left {0, 0})
gettimeofday({1304338233, 872054}, NULL) = 0
fcntl64(20, F_GETFL)                    = 0x802 (flags O_RDWR|O_NONBLOCK)
read(5, 0x9777ba0, 4096)                = -1 EAGAIN (Resource temporarily unavailable)
gettimeofday({1304338233, 872278}, NULL) = 0
poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}, {fd=9, events=POLLIN}, {fd=13, events=POLLIN}, {fd=4, events=POLLIN|POLLPRI}, {fd=17, events=POLLIN}, {fd=15, events=POLLIN}, {fd=19, events=POLLIN|POLLPRI}, {fd=14, events=POLLIN}, {fd=8, events=POLLIN}, {fd=12, events=POLLIN}], 11, 0) = 0 (Timeout)
Comment 1 Stefan Tauner 2013-06-04 08:10:14 UTC
I am not entirely sure if this is related, but I notice something very similar with my claws-mail 3.8.0. One of "my" POP3 servers seems to often shutdown (or pretend that). This happens very often after issuing the UIDL command like this:

[09:30:06] POP3< +OK Dovecot ready.
[09:30:06] POP3> STLS
[09:30:06] POP3< +OK Begin TLS negotiation now.
[09:30:07] POP3> USER <redacted>
[09:30:07] POP3< +OK
[09:30:07] POP3> PASS ********
[09:30:07] POP3< +OK Logged in.
[09:30:07] POP3> STAT
[09:30:08] POP3< +OK 26698 552720155
[09:30:08] POP3> UIDL
[09:30:08] POP3< -ERR Server shutting down.
** command not supported
[09:30:08] POP3> LAST

At least sometimes when this happens, claws-mail starts spinning in an endless loop that blocks the UI loop apparently. The GUI is only updated by certain events (resorting the message list seems to be consistently work in this situation) and I could only get this log after disconnecting from any network and wait for a timeout.

When i attach strace to the process there is an endless loop doing the following (I am not sure where it starts):
select(21, [20], NULL, NULL, {0, 0})    = 1 (in [20], left {0, 0})
recvfrom(5, 0x16689b4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}, {fd=8, events=POLLIN}, {fd=4, events=POLLIN|POLLPRI}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN|POLLPRI}, {fd=19, events=POLLIN}, {fd=7, events=POLLIN}], 9, 0) = 0 (Timeout)
read(6, 0x7fffdcc488b0, 16)             = -1 EAGAIN (Resource temporarily unavailable)
fcntl(20, F_GETFL)                      = 0x802 (flags O_RDWR|O_NONBLOCK)
recvfrom(5, 0x16689b4, 4096, 0, 0, 0)   = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=6, events=POLLIN}, {fd=5, events=POLLIN}, {fd=8, events=POLLIN}, {fd=4, events=POLLIN|POLLPRI}, {fd=11, events=POLLIN}, {fd=13, events=POLLIN}, {fd=15, events=POLLIN|POLLPRI}, {fd=19, events=POLLIN}, {fd=7, events=POLLIN}], 9, 0) = 0 (Timeout)
read(6, 0x7fffdcc488b0, 16)             = -1 EAGAIN (Resource temporarily unavailable)

I have not looked at the code, but it seems rather obvious that one wants to add a timeout for those "temporarily" unavailable resources. The return value needs to be checked for EAGAIN and maybe EWOULDBLOCK and after a number of tries (maybe after adding a short sleep) the loop has to be exited.
Comment 2 Colin Leroy 2014-04-24 14:56:59 UTC
Hi,

Is this using SSL ? If so, your bug may be #3139 and hence be fixed in git.
Comment 3 Stefan Tauner 2014-04-24 15:14:11 UTC
(In reply to comment #2)
> Hi,
> 
> Is this using SSL ? If so, your bug may be #3139 and hence be fixed in git.

For me yes, with STARTTLS. I am probably too lazy to test it for now, but if I do then I'll report back of course. Thanks for the heads up BTW! I would have missed it otherwise.
Comment 4 Colin Leroy 2014-05-22 19:47:56 UTC
Marking duplicate, please reopen if not :)

*** This bug has been marked as a duplicate of bug 3139 ***

Note You need to log in before you can comment on or make changes to this bug.