Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows] Keyman causes a crash on exit of FreeFileSync #1723

Closed
mcdurdin opened this issue Apr 17, 2019 · 14 comments

Comments

4 participants
@mcdurdin
Copy link
Member

commented Apr 17, 2019

Describe the bug

https://community.software.sil.org/t/keyman-causing-freefilesync-to-crash/2065

This problem only happens when FreeFileSync is exiting so it is not a high priority. I am running the keyman 11. Below is the email from FreeFileSync developer. Uninstalling keyman the problem goes away.

FreeFileSync is crashing during exit. The problem is most likely caused by the following DLL which is found in the call stack:

C:\Program Files (x86)\Common Files\Keyman\Keyman Engine 10.0\keyman64.dll

To Reproduce
I have not yet attempted to reproduce this issue.


(Delete the irrelevant sections)

Keyman Desktop, Keyman for macOS, Keyman for Linux (please complete the following information):

  • OS:
  • Keyman version: 11.0.1352.0
  • Target Application: FreeFileSync
@GitHubRulesOK

This comment has been minimized.

Copy link

commented May 20, 2019

Reportedly a similar crash happens with most versions of SumatraPDF including the lightweight portable single file install

It may not be the same cause but ONLY keyman 10/11 manifest the issue It should be easy to emulate using one of the portable versions at https://www.sumatrapdfreader.org/download-free-pdf-viewer.html

For details and conclusion please see https://forum.sumatrapdfreader.org/t/sumatra-pdf-crashes-when-closing/2161

@honorewatanabe

This comment has been minimized.

Copy link

commented May 21, 2019

Additional info: SumatraPDF crashes with both Keyman ver. 10 and 11. It doesn't crash with ver. 8. (I have not tested ver. 9.)
Thanks.

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented May 22, 2019

I've been trying to reproduce the problem with Keyman and SumatraPDF here but so far have been unable to -- SumatraPDF 32-bit consistently closes without a crash (Win 10 1803 64-bit). I'm not yet sure if it has the same root cause as the FreeFileSync conflict.

@honorewatanabe it would be good to investigate further with you to see if there is something specific to your configuration which is causing this crash. Would you be able to help us with that?

@honorewatanabe

This comment has been minimized.

Copy link

commented May 22, 2019

OK. What can I do to help?

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented May 23, 2019

@honorewatanabe I'd like to setup a remote diagnostic session with you to test the problem directly on your computer. I believe I have your email address already from earlier communication a few years ago, so I'll write you there with details.

@jstnlth

This comment has been minimized.

Copy link

commented May 25, 2019

I'm having the problem with FreeFileSync crashing on exit and keyman. If you want my help with that I'm available. Justin - SIL South Sudan

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented May 27, 2019

I'm having the problem with FreeFileSync crashing on exit and keyman. If you want my help with that I'm available. Justin - SIL South Sudan

@jstnlth Thanks for the offer -- can you email me to organise a time that works? I have tried to repro here without success so far.

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented May 28, 2019

@jstnlth writes:

I think this is user profile related. I tried with an administrator account, and didn't get a crash. (Of course, that could also be a permission level thing then....) I have other computers with keyman and freefilesync, but have only seen the problem on this one. And it didn't start out crashing right away when I first installed everything. At some point I was notified that freefilesync crashed, and then it has happened ever since.

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented Jun 2, 2019

Details on the SumatraPDF issue: I captured a trace with @honorewatanabe. Reviewing the trace, this happens because keyman32.dll is being unloaded after msctf.dll, which causes the cleanup for keyman32.dll to crash. On my test machines, the DLL detach order is always the other way around.

One possible resolution is to avoid cleanup on process destruction. This seems to be the most likely way to avoid the problem. I have built a test version of keyman32.dll which implements this and will test that shortly with @honorewatanabe; if this resolves the problem, we can go with that minimal patch for version 11.

In a future version, I will refactor the code that uses TSF to instead initialize and always release msctf.dll at time of use -- assuming that performance isn't adversely impacted by this (it was in earlier versions of Windows). I would prefer to do nothing at all in DLLMain but it's tricky when we don't control library lifetime using hooks.

I do not yet know if this is related to the FreeFileSync issue or not. I will be investigating that one shortly with @jstnlth.

See also https://devblogs.microsoft.com/oldnewthing/20120105-00/?p=8683 and https://docs.microsoft.com/en-us/windows/desktop/dlls/dllmain

@GitHubRulesOK

This comment has been minimized.

Copy link

commented Jun 3, 2019

Thanks for the update, glad it has be tracked down to clear what seems to be a repeatable event.

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented Jun 5, 2019

The updated build resolved the SumatraPDF conflict. Waiting to test the fix with FreeFileSync later today.

Thanks for your support, @GitHubRulesOK, @jstnlth and @honorewatanabe!

@honorewatanabe

This comment has been minimized.

Copy link

commented Jun 5, 2019

Thanks to you, @mcdurdin !!

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented Jun 5, 2019

Can confirm the new build also resolves the crash with FreeFileSync. So will go ahead and prepare an updated release for 11.0 and 12.0 with the fix. (There are a few other things happening right now so may be a week or two before the fix is available).

@mcdurdin

This comment has been minimized.

Copy link
Member Author

commented Jun 11, 2019

I believe this is resolved in 11.0.1359.0 now available at https://keyman.com/downloads/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.