Open Bug 541400 Opened 15 years ago Updated 6 years ago

quick filter / quick search in message content kills IMAP server (lots of imap search processes on server, due to incremental quick search of BODY for IMAP folder of offline-use=off)

Categories

(Thunderbird :: Search, defect)

defect
Not set
major

Tracking

(Not tracked)

People

(Reporter: mmcs, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: perf)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7
Build Identifier: TB 2.0.23, TB 3.0.0

With disabled IMAP synchronisation in TB3 search in message content works like in TB2. But TB sends the first search query to imap server after typing the first character in the search field, a second search query after typing the seacond character etc.
This is a stupid behavior, because the imap server executes all queries till the end, but TB doesn't wait for the answers. So if you search for a long word (50 characters) in a IMAP folder with lots of messages in it, you will DoS the IMAP server with 50 search processes.

Reproducible: Always

Steps to Reproduce:
1. disable IMAP synchronisation
2. Take a IMAP folder with lots of big messages, search in message content for a very long word. Do not copy & paste the word in the search field, but type it with the speed of a "low experience computer user".
Actual Results:  
see your IMAP server dying with tons of imap search processes.

Expected Results:  
TB should wait for user confirmation (enter key) of the search word and then send ONE query to the IMAP server. At least for search in message content.

This behavior is like a classical DoS attack! Send queries, don't wait for the answer...
IMAP log, with Tb 3.0.0, Quick Search option : Message Body Filter, IMAP folder : offline use=off.
Typed "m", "d", "n" in this order. Searched for "m", "md", "mdn".
Incremental search for "body" shouldn't be executed if "body search" for IMAP folder of offline use=off.
Confirming.

> 00000002	0.10044125	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:SendData: 14 uid SEARCH UNDELETED BODY "m" 	
> 00000004	0.44273198	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: * SEARCH 11636 	
> 00000006	0.44345105	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: 14 OK SEARCH completed (Success) 	
> 00000009	11.94228745	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:SendData: 15 uid SEARCH UNDELETED BODY "md" 	
> 00000011	12.21621609	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: * SEARCH 	
> 00000013	12.21651268	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: 15 OK SEARCH completed (Success) 	
> 00000016	14.84657097	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:SendData: 16 uid SEARCH UNDELETED BODY "mdn" 	
> 00000018	15.07075596	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: * SEARCH 11639 11640 11641 11642 11643 11644 11645 	
> 00000020	15.07292175	[3404] 652[3ba6740]: 3dd8400:imap.gmail.com:S-INBOX:CreateNewLineFromSocket: 16 OK SEARCH completed (Success) 	

Workaround of DoS attack like behaviour:

Dont use "Message body filter" of quick search, if IMAP folder of offline use=off exists.
If body search is required, use Edit/Find/Search Messages, or Saved search folder(Virtual Folder).
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: search in message content kills IMAP server (lots of imap search processes on server) → search in message content kills IMAP server (lots of imap search processes on server, due to incremental quick search of BODY for IMAP folder of offline-use=off)
Whiteboard: dupme
Whiteboard: dupme
Ummm... Edit/Find/Search Messages doesn't seem to have an option to search the message body... ??
(In reply to comment #2)
> Ummm... Edit/Find/Search Messages doesn't seem to have an option to search the message body... ??

When IMAP folder of offline use=off, "Body" is selectable only when "Run search on server" is checked, if Edit/Find/Search Messages(and Search of context menu).
Oh, right... thanks WADA, that was kind-of staring me in the face... :)
Keywords: perf
Summary: search in message content kills IMAP server (lots of imap search processes on server, due to incremental quick search of BODY for IMAP folder of offline-use=off) → quick filter / quick search in message content kills IMAP server (lots of imap search processes on server, due to incremental quick search of BODY for IMAP folder of offline-use=off)
Can someone with access make this bug BLOCK bug 564168?
Blocks: 564168
this was mentioned on tb-enterprise
I'm running into this a lot - it is very frustrating when entering search criteria in the Quickfilter box on a large/very large folder to have it pause for an extended period of time on the very first keypress.

Seriously, how many people search for a single character, or even two, or even three?

I would love to see a simple option (checkbox, user.js, whatever) to either DISABLE automatically applying the search on every keystroke (in which case hitting the ENTER key would execute the search), or better, define the  number of characters that must be entered before it starts auto-applying the filter (I'd probably start with 4, or no more than 3).
You need to log in before you can comment on or make changes to this bug.