D9013: POP3 resource: State CheckRemovingMessage can lead to Hotel California

Jonathan Marten noreply at phabricator.kde.org
Mon Nov 27 09:13:24 GMT 2017


marten created this revision.
marten added a reviewer: KDE PIM.
Restricted Application added a project: KDE PIM.

REVISION SUMMARY
  I've been observing instances where interval POP3 fetching in KMail stops with the progress bar still showing;  starting a manual mail check gives the message "Mail check in progress, unable to start a second check".  Despite the message, the second mail check appears to clear the stoppage but can result in old mail messages reappearing.
  
  The cause appears to be the state machine in the POP3 resource, where there are no new messages to be downloaded so the state goes from Download to CheckRemovingMessage.  If there are old messages to be deleted in checkRemovingMessageFromServer(), a delete job is started and the state remains in CheckRemovingMessage.  When the delete job finishes, deleteJobResult() checks to see if there are any more messages waiting to be deleted;  if there are none, it advances to the Quit state if shouldAdvanceToQuitState() returns true.  However, since the first part of the condition in shouldAdvanceToQuitState() is "mState==Save", this can never be true in the CheckRemovingMessage state!  The state can never leave CheckRemovingMessage and so the fetch never finishes.
  
  The solution appears to add another exit condition at the end of deleteJobResult():  if there has been no delete job started, then the state can advance to Save which will correctly use shouldAdvanceToQuitState() to decide when to continue to Quit.

TEST PLAN
  Built PIM Runtime with this change.  Observed log messages showing that the state correctly goes from CheckRemovingMessage -> Save -> Quit whether there are old messages to be removed or not.  Verified that there is no fetching lockup in KMail.

REPOSITORY
  R44 KDE PIM Runtime

REVISION DETAIL
  https://phabricator.kde.org/D9013

AFFECTED FILES
  resources/pop3/pop3resource.cpp

To: marten, #kde_pim
Cc: dvasin, winterz, vkrause, mlaurent, knauss, dvratil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20171127/9d5cb3ef/attachment.html>


More information about the kde-pim mailing list