Opened 5 years ago

Closed 5 years ago

#4385 defect closed fixed (fixed)

IMAP4 server loops indefinitely if a search query yields more than 4 items

Reported by: wulczer Owned by:
Priority: normal Milestone:
Component: mail Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

The responsible code seems to be

if i == 4:
    from twisted.internet import reactor
    reactor.callLater(
        0, self.__cbManualSearch, result, tag, mbox, query, uid,
        searchResults)

in IMAP4Server.cbManualSearch.

It seems to me that it should be slicing the first four items off the result list before calling itself again.

Attachments (2)

twisted-4385-imap4-loop.patch (2.8 KB) - added by wulczer 5 years ago.
patch to fix the issue
twisted-4385-imap4-loop-v2.patch (4.5 KB) - added by wulczer 5 years ago.
rebased patch to trunk

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by wulczer

patch to fix the issue

comment:1 Changed 5 years ago by wulczer

  • Keywords review added
  • Owner exarkun deleted

comment:2 follow-up: Changed 5 years ago by therve

  • Keywords review removed
  • Owner set to wulczer

DefaultSearchTestCase.test_searchAndMessageSet is freezing for me. The patch doesn't seem to be again latest trunk, maybe it's the problem?

Changed 5 years ago by wulczer

rebased patch to trunk

comment:3 in reply to: ↑ 2 Changed 5 years ago by wulczer

  • Keywords review added
  • Owner wulczer deleted

Replying to therve:

DefaultSearchTestCase.test_searchAndMessageSet is freezing for me. The patch doesn't seem to be again latest trunk, maybe it's the problem?

Yes, you're right, the patch was bad. I rebased it against latest trunk (attached).

comment:4 Changed 5 years ago by exarkun

  • Keywords review removed
  • Owner set to exarkun
  • Status changed from new to assigned

Thanks. The patch looks good. I'll apply it.

comment:5 Changed 5 years ago by exarkun

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [28818]) Apply twisted-4385-imap4-loop-v2.patch to fix the infinite loop in IMAP4 server search handling

Author: wulczer
Reviewer: therve, exarkun
Fixes: #4385

Previously the fallback search implementation provided by IMAP4Server would examine the first five
messages in a mailbox forever, trying to respond to a search command. This fixes it to actually
iterate over all the messages in the mailbox and eventually complete.

comment:6 Changed 4 years ago by <automation>

  • Owner exarkun deleted
Note: See TracTickets for help on using tickets.