Download it now!
Bug 47179 - performance depends on /etc/hosts (svt::DocumentLockFile::CreateOwnLockFile calls gethostbyname_r)
Summary: performance depends on /etc/hosts (svt::DocumentLockFile::CreateOwnLockFile c...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
3.4.4 release
Hardware: Other Linux (All)
: medium normal
Assignee: Not Assigned
: 97931 (view as bug list)
Depends on:
Reported: 2012-03-10 02:11 UTC by Jérôme
Modified: 2019-08-18 08:53 UTC (History)
9 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Jérôme 2012-03-10 02:11:34 UTC
I read on forums that tweaking the /etc/hosts file speeds up the LibreOffice startup by ~ 10 times :

The tweak is changing the below lines :
--- localhost MY_HOST_NAME

into :
--- MY_HOST_NAME localhost MY_HOST_NAME.(none)
Comment 1 sasha.libreoffice 2012-05-31 04:07:50 UTC
Thanks for bugreport
Ubuntu specific?
Comment 2 Jérôme 2012-05-31 12:03:33 UTC
I don't think it is Ubuntu specific.
Comment 3 sasha.libreoffice 2012-06-01 00:40:50 UTC
> I don't think it is Ubuntu specific.
Reproducible on another distro (non-Canonical) ?
Comment 4 Jérôme 2012-06-02 04:38:28 UTC
I don't know.
Comment 5 Mas 2012-09-13 06:43:05 UTC
closing this ticket , The /etc/hosts file is for networking and not application bootup time.
Comment 6 Jérôme 2012-09-15 14:50:22 UTC
Basically, the internal components are heavily using local loop network. Depending on the path the data is using, the latency may increase. Thus the boot time actually depends on network configuration.
Comment 7 Stephan Bergmann 2013-08-13 13:18:22 UTC
Quoting <>:

"Per the attached log.txt, it is a slow DNS query (against your local 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("")}, 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)."
Comment 8 Joel Madero 2014-11-06 22:25:56 UTC
Looks like this needs confirmed again (or first time?) by QA, moving to UNCONFIRMED. Thanks all
Comment 9 Mattia 2015-02-08 16:40:56 UTC
I can confirm this problem on Fedora 21. I was astonished by the slowness of libreoffice startup. These are the timings of opening and immediately closing libreoffice on my system:

BEFORE editing /etc/hosts
$ time libreoffice

real    0m11.646s
user    0m0.696s
sys     0m0.158s

AFTER editing /etc/hosts
$ time libreoffice

real    0m1.263s
user    0m0.645s
sys     0m0.134s

Is it really needed querying DNSs for the local machine hostname (that will fail in 99% of cases)?
Comment 10 Matthew Francis 2015-03-23 10:15:56 UTC
Both comment 7 and comment 9 look like confirmation to me. A quick check of the source files in question suggests that the code in question hasn't meaningfully changed since the report either.

Setting -> NEW
Comment 11 tommy27 2016-04-16 07:24:23 UTC Comment hidden (obsolete)
Comment 12 Aron Budea 2016-12-17 23:17:24 UTC
*** Bug 97931 has been marked as a duplicate of this bug. ***
Comment 13 Jérôme 2016-12-19 21:15:32 UTC
This current bug appears in release according to the description in the duplicate bug #97931 .
Comment 14 QA Administrators 2017-12-20 03:35:05 UTC Comment hidden (obsolete)
Comment 15 Jérôme 2017-12-30 14:16:08 UTC
I couldn't reproduce this bug with the version shipped with the Debian 9.3 (stretch) running on x86(IA32).

Before I performed the test, I stopped services with the below command :
systemctl stop *.timer
systemctl stop

The NetworkManager.service is disabled on this host (no need to stop).

However, I don't known if there is a local DNS proxy somewhere which makes the lookup faster.
Comment 16 QA Administrators 2018-12-31 03:42:29 UTC Comment hidden (obsolete)
Comment 17 Kevin Suo 2019-08-18 08:53:47 UTC
This bug still exists in

Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
CPU 线程: 4; 操作系统: Linux 5.2; UI 渲染: 默认; VCL: gtk3; 
区域语言: zh-CN (zh_CN.UTF-8); UI 语言: zh-CN
Calc: threaded
Fedora 30 x64.

Before loading a document, if I switch off the network, the document loading time is <3 seconds. If I turn on the network, it takes >30 seconds.

This does not happen on all networks. It happens on some networks only (e.g., now in my hotel).