Bug 996013

Summary: libreoffice start is very slow to open file
Product: [Fedora] Fedora Reporter: lionghostshop
Component: libreofficeAssignee: Caolan McNamara <caolanm>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: caolanm, dtardon, erack, lionghostshop, ltinkl, mstahl, sbergman
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-13 13:15:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
log file none

Description lionghostshop 2013-08-12 08:30:26 UTC
Description of problem:


Version-Release number of selected component (if applicable):
libreoffice-core-4.1.0.4-6.fc19.x86_64

How reproducible:


Steps to Reproduce:
1. Open write
2. open a file


Actual results:
Very slow even for small file

Expected results:
Load the file immediately

Additional info:

Firfox is also very slow to start.

Comment 1 David Tardon 2013-08-12 08:38:22 UTC
(In reply to lionghostshop from comment #0)
> Actual results:
> Very slow even for small file

Meaning what? >1 minute? >10 seconds? >1 second? >100 miliseconds?

Can you attach a sample file?

> Firfox is also very slow to start.

Well, have you considered the possibility that the problem is in your hardware? E.g., slow disk or insufficient amount of memory.

Comment 2 lionghostshop 2013-08-12 08:42:58 UTC
It takes more than 5 seconds. 
It is not the hardware problem. My hardware is fast and I am using SSD. I have 8 GB memory.
It is very fast to start office while it is very slow to open file (any file even very small one). The problem is not specific to any input file. 

When it is opening, the CPU is not busy. It seems waiting for something.

Comment 3 Stephan Bergmann 2013-08-12 13:31:25 UTC
(In reply to lionghostshop from comment #2)
> When it is opening, the CPU is not busy. It seems waiting for something.

If the file to open is /foo/bar/baz.odt say, can you please call in a terminal window

 strace -fttT soffice /foo/bar/baz.odt >log.txt 2>&1

hit Ctrl-Q once LibreOffice has loaded the document, and attach here the resulting log.txt.

Comment 4 lionghostshop 2013-08-12 15:20:36 UTC
Created attachment 785756 [details]
log file

Comment 5 Stephan Bergmann 2013-08-13 13:15:51 UTC
Per the attached log.txt, it is a slow DNS query (against your local 192.168.8.1 server) to resolve your machine name ("thinkpad-leo"), blocking the main thread for 4 seconds:

> [pid 23019] 23:18:13.598278 socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 34 <0.000013>
> [pid 23019] 23:18:13.598322 connect(34, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.8.1")}, 16) = 0 <0.000019>
> [pid 23019] 23:18:13.598380 poll([{fd=34, events=POLLOUT}], 1, 0) = 1 ([{fd=34, revents=POLLOUT}]) <0.000010>
> [pid 23019] 23:18:13.598426 sendto(34, "\17D\1\0\0\1\0\0\0\0\0\0\fthinkpad-leo\0\0\1\0\1", 30, MSG_NOSIGNAL, NULL, 0) = 30 <0.000061>
> [pid 23019] 23:18:13.598569 poll([{fd=34, events=POLLIN}], 1, 5000 <unfinished ...>
...
> [pid 23019] 23:18:17.641166 <... poll resumed> ) = 1 ([{fd=34, revents=POLLIN}]) <4.042540>

The reason this query is done is because svt::DocumentLockFile::CreateOwnLockFile calls osl_getLocalHostname which, when getting an unqualified name from gethostname(2) calls gethostbyname_r(3).

See upstream <https://bugs.freedesktop.org/show_bug.cgi?id=47179#c0> for a workaround.