summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-08-11 11:04:14 +0200
committerCaolán McNamara <caolanm@redhat.com>2022-08-11 18:07:39 +0200
commit7e989259c63946b17cc0c7b765e4fa8261a06507 (patch)
tree54405e1986f03dea7fe687a4a9b4917131f96459 /connectivity
parentef46b72f90f66892c06a513cd326916269f296c3 (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/+/138111 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'connectivity')
-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();
}
}