Bug 106933 - LibO crashes on shutdown in TpReleaseCleanupGroupMembers destroying global D2DWriteTextOutRenderer instance
Summary: LibO crashes on shutdown in TpReleaseCleanupGroupMembers destroying global D2...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
5.3.2.1 rc
Hardware: All Windows (All)
: medium normal
Assignee: Michael Stahl
QA Contact:
URL:
Whiteboard: target:5.4.0 target:5.3.3
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-03 19:18 UTC by Eugene Kin
Modified: 2017-04-15 21:09 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Backtrace - Crash on first startup (Windows Server 2008) (11.13 KB, text/plain)
2017-04-13 12:19 UTC, Eugene Kin
Details
Backtrace - Crash on exit (Windows Server 2008 R2) (8.10 KB, text/plain)
2017-04-13 12:20 UTC, Eugene Kin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Kin 2017-04-03 19:18:45 UTC
soffice.bin crashes with ntdll.dll on very first startup (splash - crash)
and every time on close the last document.

OS: Windows Server 2008 / Windows Server 2008 R2
LibO: 5.3.2.2
Comment 1 Julien Nabet 2017-04-04 10:02:11 UTC
For the test, coud lso rename your LO directory profile (see https://wiki.documentfoundation.org/UserProfile#Windows) and give a new try?
Comment 2 Eugene Kin 2017-04-04 12:14:28 UTC
Negative. New profile crashes too.
Comment 3 Buovjaga 2017-04-12 18:17:50 UTC
You could try this to get a backtrace: https://wiki.documentfoundation.org/How_to_get_a_backtrace_with_WinDbg#Automation
Comment 4 Eugene Kin 2017-04-13 12:19:05 UTC
Created attachment 132534 [details]
Backtrace - Crash on first startup (Windows Server 2008)

OS - Windows Server 2008 SP2 with latest updates / Windows Server 2008 R2 SP1 with latest updates
LibO - 5.3.2

Steps to reproduce:

1) Install LibO 5.3.2 OR delete/rename old profile folder if 5.3.2 version is already installed
2) Start LibO
3) You will get crash on first startup
4) You will get crash on every exit

In my case problem reproducible since LibO 5.3.2.1 ONLY on Server 2008 / 2008 R2.
LibO 5.3.2 works without crashes on Windows 7.

LibO 5.3.1 works without crashes on ALL Windows.
Comment 5 Eugene Kin 2017-04-13 12:20:38 UTC
Created attachment 132535 [details]
Backtrace - Crash on exit (Windows Server 2008 R2)
Comment 6 Michael Stahl 2017-04-13 12:48:42 UTC
both of these traces are DllMain running global variable dtors,
with this static D2DWriteTextOutRenderer in vcl/win/gdi/winlayout.cxx
being the likely culprit:

TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
{
    if (bUseDWrite)
    {
        static std::unique_ptr<TextOutRenderer> _impl(D2DWriteTextOutRenderer::InitModules()
            ? static_cast<TextOutRenderer*>(new D2DWriteTextOutRenderer())
            : static_cast<TextOutRenderer*>(new ExTextOutRenderer));

        return *_impl;
    }


speculating why this crashes: the crash is inside a ThreadManager_VistaThreadPool::~ThreadManager_VistaThreadPool,
and at this point in shutdown only the thread that has
called exit() is still running, all other threads have
been terminated by Win32 already, so maybe this
wants to access something that is no longer there.

i wonder if it would help to move the instance somewhere
where it can be deleted from DeInitVCL()? it shouldn't be needed
after DeInitVCL() hopefully?
Comment 7 Michael Stahl 2017-04-13 12:57:44 UTC
okay, Raymond Chen says doing this is stupid
https://blogs.msdn.microsoft.com/oldnewthing/20120427-00/?p=7763/
Comment 8 Michael Stahl 2017-04-13 17:05:51 UTC
should be fixed on master
Comment 9 Commit Notification 2017-04-13 17:07:38 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=df556aa47da22f96b3fcd356c12419d3035cba3c

tdf#106933 vcl: delete D2DWriteTextOutRenderer before exit()

It will be available in 5.4.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Eugene Kin 2017-04-14 07:40:45 UTC
And what about 5.3 branch?
Comment 11 Commit Notification 2017-04-15 21:09:23 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-5-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1ba5bae490f7e14e475e0b80f03e5f444cdce908&h=libreoffice-5-3

tdf#106933 vcl: delete D2DWriteTextOutRenderer before exit()

It will be available in 5.3.3.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.