office-gobmx/connectivity/source/cpool
Caolán McNamara 7e989259c6 connectivity: avoid divide by zero in calculateTimeOuts
See https://crashreport.libreoffice.org/stats/signature/connectivity::OConnectionPool::propertyChange(com::sun:🫘: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>
2022-08-11 18:07:39 +02:00
..
dbpool2.component
ZConnectionPool.cxx
ZConnectionPool.hxx
ZConnectionWrapper.cxx
ZConnectionWrapper.hxx
ZDriverWrapper.cxx
ZDriverWrapper.hxx
ZPoolCollection.cxx
ZPoolCollection.hxx
ZPooledConnection.cxx
ZPooledConnection.hxx