Closed Bug 1249056 Opened 8 years ago Closed 1 year ago

Thunderbird freezes periodically when Windows search integration is enabled

Categories

(Thunderbird :: Search, defect)

38 Branch
Unspecified
Windows 10
defect
Not set
major

Tracking

(Not tracked)

RESOLVED INCOMPLETE

People

(Reporter: dr.andreas.lemke, Unassigned)

References

()

Details

(Keywords: perf)

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0
Build ID: 20160210153822

Steps to reproduce:

Enable Windows 10 search integration in Thunderbird preferences. Move messages between IMAP folders.


Actual results:

In approx. 10% of the moves, Thunderbird freezes for about 1 minute. After that the move is complete. Process monitor shows that Thunderbird is trying to access a wdseml file in a mozmsgs folder at the time it is frozen. I suspect that a deadlock with a concurrent access to that file by the windows search indexer occurs. After disabling the Windows 10 search integration, the freeze problem disappears.


Expected results:

Moves between IMAP folders should not cause Thunderbird to freeze even if Windows 10 search integration is activated.
Thunderbird has no reason to access to file after it is created or after a deleted (related to a move) has occurred.  And afaik no other software should be accessing the file synchronously or exclusively.  So, the interference is likely some other software. For example antivirus SW, which should not be accessing anything the the Thunderbird profile directory hierarchy. 

Which AV software are you using? What happens if you disable it or define an exclusion for Thunderbird profile directory?
Flags: needinfo?(dr.andreas.lemke)
Keywords: perf
OS: Unspecified → Windows 10
Summary: Thunderbird freezes periodically when Windows 10 search integration is enabled → Thunderbird freezes periodically when Windows search integration is enabled
(In reply to Wayne Mery (:wsmwk, use Needinfo for questions) from comment #1)
> Thunderbird has no reason to access to file after it is created or after a
> deleted (related to a move) has occurred.  And afaik no other software
> should be accessing the file synchronously or exclusively.  So, the
> interference is likely some other software. For example antivirus SW, which
> should not be accessing anything the the Thunderbird profile directory
> hierarchy. 

I can see from process monitor (the tool from SysInternals) that Thunderbird freezes as it tries to move the wdseml file. I can see a system function called and a delay of approx. 1 minute before the "SUCCESS" result is displayed.

> 
> Which AV software are you using? What happens if you disable it or define an
> exclusion for Thunderbird profile directory?

None other than the Windows Defender which comes with Windows 10. As far as I know, exclusions cannot be defined in Windows Defender.
Flags: needinfo?(dr.andreas.lemke)
> I can see a system function called and a delay of approx. 
In process monitor you need to dig deeper to see which system function is being used. 
iirc you want to look at process tree

> As far as I know, exclusions cannot be defined in Windows Defender.
http://windows.microsoft.com/en-us/windows-10/add-an-exclusion-to-windows-defender
> In process monitor you need to dig deeper to see which system function is being used. 

After some further investigation with Process Monitor I got the following protocol:

Time             Process                Operation                Path
20:46:53,4704783 thunderbird.exe        SetRenameInformationFile source.mozmsgs\somefilename.wdseml
20:48:21,6206965 SearchProtocolHost.exe CloseFile                source.mozmsgs\somefilename.wdseml
20:48:21,6225034 thunderbird.exe        CloseFile                target.mozmsgs

Seems to me that thunderbird.exe is waiting for SearchProtocolHost.exe to release the file somefilename.wdseml. In between 46:53 and 48:21 Thunderbird is frozen.
What is this folder source.mozmsgs? Where is it located, and what is it used for?
(In reply to Kent James (:rkent) from comment #5)
> What is this folder source.mozmsgs? Where is it located, and what is it used
> for?

"source" is the IMAP folder where the message was before I moved it. "target" then is the folder where I moved it.
It's located here:
...\AppData\Roaming\Thunderbird\Profiles\xyz.default\ImapMail\mailservername\source.mozmsgs
It's used to store the *.wdseml files that Thunderbird creates for Windows Desktop Search.
(In reply to Andreas from comment #6)
> (In reply to Kent James (:rkent) from comment #5)
> > What is this folder source.mozmsgs? Where is it located, and what is it used
> > for?
> 
> "source" is the IMAP folder where the message was before I moved it.
> "target" then is the folder where I moved it.
> It's located here:
> ...\AppData\Roaming\Thunderbird\Profiles\xyz.
> default\ImapMail\mailservername\source.mozmsgs
> It's used to store the *.wdseml files that Thunderbird creates for Windows
> Desktop Search.

Correct. When "Allow Windows Search to search messages" is enabled, for every thunderbird <folder> there is an equivalent <folder>.mozmsgs folder which holds every email as a separate .wdseml file. 

.mozmsgs folders have the file attribute "Allow files in this folder to have contents indexed"
.wdseml files have the file attribute "Allow this file to have contents indexed"
And .wdseml extension type is identified to WSS (Windows Search Service) to be indexed by contents and file attributes. http://windows.microsoft.com/en-us/windows7/change-advanced-indexing-options
BTW, your data is very detailed, which is a great thing to have.

I don't know what's causing the delay, and I don't know the internals of Thunderbird in this area. Given that it's an imap folder, it seems to me the process is Thunderbird 1. copies the message to the imap folder, 2. deletes the message from the source imap folder 3. wdseml file gets deleted. And somewhere in there the new wdseml file is created - but I think that step should have no impact.

Can you reproduce the delay if you copy a message from imap to local folder, or from local folder to local folder?
Flags: needinfo?(dr.andreas.lemke)
Some further experiments gave these results:

imap or pop3 inbox immediately after new message received -> any imap or local folder => delay
any other move (e. g. local to local, imap to local, etc.) => no delay

where -> means message moved to
      => means results in
Flags: needinfo?(dr.andreas.lemke)
I'm hoping sid0 will be able to offer insight on comment 4 and related items
Flags: needinfo?(sid.bugzilla)
I wonder if windows indexing service has a bug, or is less performant, in Windows 10
Severity: normal → major
As I already described in bug 1283908 I can see the same behavior even when "Allow Windows Search to search messages" is deactivated.

The only workaround that worked for me was disabling the Windows service "Windows Search".
Depends on: 1283908
See Also: 1283908
Update:
I now noticed that I also encounter this problem when Thunderbird is trying to save a draft to the drafts directory.
The Windows service "Windows Search" was NOT running.
Alexander,

What is size of windows.edb in C:\ProgramData\Microsoft\Search\Data\Applications\Windows ?
Is your disk SSD, slow laptop disk, or fast non-SSD?
And how much free space is available on your disk?
Flags: needinfo?(dr.andreas.lemke)
Same question for Andreas
Flags: needinfo?(alexander.buchner)
File size is approx. 80 MB. 
Disk type is SSD. 
Free disk space is approx. 65 GB.
Flags: needinfo?(dr.andreas.lemke)
File size is approx. 752 MB. 
Disk type is SSD. 
Free disk space is approx. 28 GB.
Flags: needinfo?(alexander.buchner)
Blocks: 1307156
See Also: → 1308783
Does anyone better understand what is happening here?   (Now that we're a couple years into this)

Why are some users affected and not others?
Why is this worse in win10 than win7?  
And is there anything we can do to mitigate this?

ditto bug 1308783
Flags: needinfo?(sid.bugzilla)

Andreas,

Do you still see this when using version 102? If you do, please create a performance profile using the procedure at https://support.mozilla.org/en-US/kb/profiling-thunderbird-performance

Flags: needinfo?(dr.andreas.lemke)
Whiteboard: [closeme 2022-10-01]

Resolved per whiteboard

Status: UNCONFIRMED → RESOLVED
Closed: 1 year ago
Flags: needinfo?(dr.andreas.lemke)
Resolution: --- → INCOMPLETE
Whiteboard: [closeme 2022-10-01]
You need to log in before you can comment on or make changes to this bug.