Bug 68750 - FILEOPEN: freeze Writer when opening a file
Summary: FILEOPEN: freeze Writer when opening a file
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Linguistic (show other bugs)
Version:
(earliest affected)
4.0.4.2 release
Hardware: Other Windows (All)
: medium normal
Assignee: Michael Stahl (CIB)
URL:
Whiteboard: BSA target:4.2.0 target:4.1.2
Keywords: perf, regression
Depends on:
Blocks:
 
Reported: 2013-08-30 12:39 UTC by Alex
Modified: 2015-12-15 11:17 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Standart form-header in organization for which I work (95.50 KB, application/msword)
2013-08-30 12:39 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2013-08-30 12:39:05 UTC
Created attachment 84909 [details]
Standart form-header in organization for which I work

Problem description: Writer freeze on ~1.5 min.  

Steps to reproduce:
1. open document (in attachment)

Current behavior: freeze

Expected behavior: open.


Hardware:
1. CPU - AMD Sempron, 1600 MHz (8 x 200) 2600+
2. Motherboard - Epox EP-8HMMI-A  (3 PCI, 1 AGP, 2 DDR DIMM, Audio, Video, LAN) 
3. Ram 768 MB  (PC3200 DDR SDRAM)

PS. Sorry for my bad English          
Operating System: Windows XP
Version: 4.1.0.4 release
Comment 1 tommy27 2013-08-31 14:05:16 UTC
tested on Win7 64bit with multiple versions

4.1.1 --> opens and freezes after few seconds
4.0.4 --> opens and freezes after few seconds
3.6.7 --> no freeze
3.5.7 --> no freeze
3.4.6 --> no freeze

interestingly it doesn't freeze using 4.2.0.0.alpha0+ 2013-08-31.

so it seems a regression of the 4.0.x branch that has been fixed somehow in 4.2.x.
it would be nice to discover what reverted the bug and backport it to 4.1.x

updating version, changing status to NEW, adding REGRESSION keywoard and adding Writer expert to CC list.
Comment 2 Michael Stahl (CIB) 2013-09-02 14:05:14 UTC
here on Linux the UI is indeed blocked after loading for about 20 seconds,
which did not happen on 3.6.7; contrary to comment #1 i see this on master too.

the main thread is blocked on a mutex while checking a grammar checker flag;
the thread 2 is running a GrammarCheckingIterator
from linguistic/source/gciterator.cxx, and is mostly in some ICU
breakiterator code.  clearly something must be going wrong
if that takes 20 seconds on a 1 page document.

lol... problem was introduced by:

commit a33dbc169037d985f104c83d01d5efd9982413de
Author:     Stephan Bergmann <sbergman@redhat.com>
AuthorDate: Tue Oct 23 15:23:09 2012 +0200

    Related fdo#46808: Fix pre-existing bug identified in previous commit
    
    Assigning to dead xBreakIterator instead of m_xBreakIterator had been introduced
    with 9f2fde7ab5de20926bb25a6b298b4e5dffb66eb2 "#i103496#: split svtools; improve
    ConfitItems," and just fixing it does not cause any tests to start breaking for
    me.


... so GetSuggestedEndOfSentence spends all this time checking a string consisting of 17399 spaces (the entire content of the first paragraph),
 and the reason it wasn't slow in 3.6 is that the break iterator variable
was not properly initialized and the whole function was skipped ...

for additional lulz i've looked at the document in Word 2010 and
evidently the document statistic function cannot count more than
746 consecutive spaces, selecting more than that results in
"Characters (with spaces)  0".


i've added a low-risk local fix to GrammarCheckingIterator on master,
not sure if it would be a better idea to change
BreakIterator_Unicode::endOfSentence() instead to never return
a position samller than the start pos...
Comment 3 Commit Notification 2013-09-02 14:10:52 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "master":

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

fdo#68750: ensure that GetSuggestedEndOfSentence makes progress



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 4 Commit Notification 2013-09-03 11:58:13 UTC
Michael Stahl committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=aa9bef8271ed50a397c959ed53c91ee44b3dcb10&h=libreoffice-4-1

fdo#68750: ensure that GetSuggestedEndOfSentence makes progress


It will be available in LibreOffice 4.1.2.

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 5 Robinson Tryon (qubit) 2015-12-15 11:17:04 UTC
Migrating Whiteboard tags to Keywords: (perf)
[NinjaEdit]