summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-11 11:04:14 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2022-08-15 12:28:51 +0200
commitd42910a040ab71e0441299caf6b017989f295131 (patch)
tree632c9d3ec360ab3d4da72dc49444b38df56400cc
parentd484e8ba447de90fd77d0244a2cda1400bbe6232 (diff)
connectivity: avoid divide by zero in calculateTimeOuts
See https://crashreport.libreoffice.org/stats/signature/connectivity::OConnectionPool::propertyChange(com::sun::star::beans::PropertyChangeEvent%20const%20&) To reproduce this, blow away your config and start writer, visit tools, options, base, connections and enable connection pooling enabled, find com.sun.star.sdbcx.comp.hdqldb.Driver and "enable pooling for this driver" and "apply" with the default 120 seconds, ok and exit then open a database (based on hsqldb) and click on "tables" (to start a connection) that default 120 seconds is the input for calculateTimeOuts (this becomes a final m_nALiveCount of 10 by the divide by 20), now visit the options again and change the 120 to something else and ok and the input for calculateTimeOuts is the old "10" calculated before and not the new expected value. The reason appears to be in OConnectionPool::propertyChange, it expects to get the new value of the property from evt.NewValue but it gets an empty Any so the m_nALiveCount is not actually changed, so the assumption it was set and will be >= 20 and sanely divisible by 20 doesn't hold. For this easy fix, fetch the new value explicitly from the config Change-Id: Ie91bf5328634f9aafbda1814b10c29b86a3f9cbe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138119 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r--connectivity/source/cpool/ZConnectionPool.cxx2
1 files changed, 1 insertions, 1 deletions
diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx
index cc90fa464e16..23e6dda1d226 100644
--- a/connectivity/source/cpool/ZConnectionPool.cxx
+++ b/connectivity/source/cpool/ZConnectionPool.cxx
@@ -282,7 +282,7 @@ void SAL_CALL OConnectionPool::propertyChange( const PropertyChangeEvent& evt )
{
if(TIMEOUT_NODENAME == evt.PropertyName)
{
- evt.NewValue >>= m_nALiveCount;
+ OPoolCollection::getNodeValue(TIMEOUT_NODENAME, m_xDriverNode) >>= m_nALiveCount;
calculateTimeOuts();
}
}