Bug 405329 - CPU loop reconciling if all transactions are cleared
Summary: CPU loop reconciling if all transactions are cleared
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: database (show other bugs)
Version: 5.0.3
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-10 21:15 UTC by jdmore6
Modified: 2019-03-14 17:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.0.4


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jdmore6 2019-03-10 21:15:09 UTC
SUMMARY
When reconciling a credit card account, if "Configure->Ledger->Data entry->Automatic reconciliation" is checked, and all transactions to be reconciled are already cleared (after downloading transactions for example, so the Cleared balance == the Ending balance in the reconcile wizard), the reconcile wizard goes into a CPU loop (100% of 1 cpu). kmymoney has to be killed. This only happens if "Automatic reconciliation" is checked.


STEPS TO REPRODUCE
1. Open a credit card account and download transactions so that the cleared balance in kmymoney equals the current statement balance.
2. Reconcile in kmymoney. At the end of the reconcile wizard, kmymoney locks up (becomes unresponsive) and has to be killed
3. 

OBSERVED RESULT
Kmymoney locks up following reconciliation wizard, using 12% cpu on 8-thread system

EXPECTED RESULT
Continue with account reconciliation.


SOFTWARE/OS VERSIONS
Windows: 
MacOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 5.14.5
KDE Frameworks Version: 5.54.0
Qt Version: 5.11.3

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2019-03-11 14:18:58 UTC
Analysis showed, that the automatic algorithm is not performing well when working on a larger set of (not reconciled or cleared) transactions (maybe more than a few tens). This seems to apply only if there is a difference between the sum of all transactions and the expected amount. In case there is no difference, the wizard returns immediately.
Comment 2 Thomas Baumgart 2019-03-14 17:33:19 UTC
Git commit f4c359840e16d6c91dc7db8480209c56557046cc by Thomas Baumgart.
Committed on 14/03/2019 at 17:32.
Pushed by tbaumgart into branch '5.0'.

Improve automatic reconciliation

It took way too long for the number of combinations to calculate. The
total of combinations checked has been reduced from 300.000 to 60.000
before the search is terminated. Also, the progress bar has been fixed
so that there is some visual feedback to the user during the
calculations.
FIXED-IN: 5.0.4

M  +18   -9    kmymoney/views/kgloballedgerview_p.h

https://commits.kde.org/kmymoney/f4c359840e16d6c91dc7db8480209c56557046cc