https://bugs.documentfoundation.org/show_bug.cgi?id=168685
Bug ID: 168685
Summary: failure to bind socket acceptor in Acceptor::run()
results in busy loop with 100% cpu usage
Product: LibreOffice
Version: 4.1 all versions
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: sdk
Assignee: [email protected]
Reporter: [email protected]
Description:
Acceptor::run() wraps its body in a for(;;) loop. For a socket acceptor, the
first line below will trigger an attempt to bind to the ip/port specified in
the connection string. The next line checks to see if a valid connection was
returned, if not, it breaks out of the for loop:
// accept connection
Reference< XConnection > rConnection = m_rAcceptor->accept(
m_aConnectString );
// if we return without a valid connection we must assume that the
acceptor
// is destructed so we break out of the run method terminating the
thread
if (! rConnection.is()) break;
If the socket acceptor fails to bind for some reason, an exception is thrown,
so the break is not executed. Instead the catch block just warns of the error
then immediately loops:
} catch (const Exception&) {
TOOLS_WARN_EXCEPTION("desktop.offacc", "");
// connection failed...
// something went wrong during connection setup.
// just wait for a new connection to accept
}
There are lots of simple ways to reproduce, including providing an invalid
hostname, a hostname/ip that is not local to the machine, a privileged port, a
port that is already is use, etc. This was discovered because accept was
configured for "localhost" via ooSetupConnectionURL in
registrymodifications.xcu and via --accept with "127.0.0.1". One would succeed
and bind to the port, the other would fail to bind because the port was in use,
triggering the busy loop.
Steps to Reproduce:
Launch soffice with argument: --accept='socket,host=1.1.1.1,port=8100;urp;'
Actual Results:
It will attempt and fail to bind to 1.1.1.1, triggering an exception which is
logged, then repeat in a busy loop. This causes the thread to use ~100% CPU.
Expected Results:
Failure to bind should break out of the Acceptor::run().
Reproducible: Always
User Profile Reset: Yes
Additional Info:
Change submitted: https://gerrit.libreoffice.org/c/core/+/191842
--
You are receiving this mail because:
You are the assignee for the bug.