two oddnesses in new ledger

Jack ostroffjh at users.sourceforge.net
Sat Jul 2 00:54:25 BST 2022


[trimming to just the problem with apparent bad schedule date]

On 2022.07.01 11:58, thb at net-bembel.de wrote:
> Jack via KMyMoney-devel schrieb am 01.07.2022 15:49 (GMT +02:00):
> > On 7/1/22 04:34, thb--- via KMyMoney-devel wrote:
> >> Jack via KMyMoney-devel schrieb am 30.06.2022 18:42 (GMT +02:00):
> >>
>>>> First, on startup (multiple times) I get a pop-up: Unable to enter  
>>>> scheduled transaction 'Patreon Podcast'  with details "Unable to  
>>>> add transaction with invalid postdate  
>>>> /var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/mymoney/mymoneyfile.cpp:1540."
there was apparently a commit to that file, so the line is now  1569

>>> Hmm, that happens indeed when the postdate is invalid. So we have  
>>> to figure out why that is. Is this caused by an auto-enter upon  
>>> start of the application?
>> Yes, on startup, before I do anything.  I have not yet tried it  
>> today, but that schedule is for today. Both in the ledger and the  
>> Scheduled transactions View, that schedule seems to correctly show  
>> the next date as 2022-07-01, or tomorrow.
[corrected typo in above line]
>>> I expect that 4th digit '2' in the date to be a typo. Then July 1st  
>>> is in fact a valid date, but it does not seem to be setup when the  
>>> transaction is actually created. We need to figure out where that  
>>> happens. That is why I asked above about the auto start feature.
>> Yes, that was just a typo on my part.  The date was correctly  
>> 2022-07-01.  There are also schedules for 2 July, so we have one  
>> more day to diagnose before creating fake data. :-)   The version I  
>> have currently compiled does have full debugging info, so I can run  
>> under gdb if you want to suggest where to set a breakpoint.
> 
> I would set it on mymoneyfile.cpp:1540 (that should be the throw  
> statement) and analyze the backtrace to find out where it came from.  
> That should give us more information.
Here's the BT

(gdb) bt
#0  MyMoneyFile::addTransaction(MyMoneyTransaction&)  
(this=0x7ffff7b4bab0 <MyMoneyFile::instance()::file>, transaction=...)  
at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/mymoney/mymoneyfile.cpp:1569
#1  0x0000555555670939 in  
KScheduledViewPrivate::enterSchedule(MyMoneySchedule&, bool, bool)  
(this=0x555555dcf830, schedule=..., autoEnter=autoEnter at entry=true,  
extendedKeys=extendedKeys at entry=true) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/views/kscheduledview_p.h:282
#2  0x000055555566a02f in  
KScheduledView::enterSchedule(MyMoneySchedule&, bool, bool)  
(this=<optimized out>, schedule=..., autoEnter=autoEnter at entry=true,  
extendedKeys=extendedKeys at entry=true) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/views/kscheduledview.cpp:122
#3  0x000055555564c815 in KMyMoneyView::enterSchedule(MyMoneySchedule&,  
bool, bool) (this=<optimized out>, schedule=...,  
autoEnter=autoEnter at entry=true, extendedKeys=extendedKeys at entry=true)  
at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/views/kmymoneyview.cpp:273
#4  0x00005555555e74f3 in KMyMoneyApp::slotCheckSchedules()  
(this=0x555555cc0f60) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/kmymoney.cpp:3830
#5  0x00005555555d6181 in KMyMoneyApp::qt_static_metacall(QObject*,  
QMetaObject::Call, int, void**) (_o=0x555555cc0f60, _c=<optimized out>,  
_id=<optimized out>, _a=0x55555ecb93d8) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999_build/kmymoney/kmymoney_autogen/EWIEGA46WW/moc_kmymoney.cpp:446
#6  0x00007ffff5eac4e6 in QObject::event(QEvent*) () at  
/usr/lib64/libQt5Core.so.5
#7  0x00007ffff77b14f7 in KXmlGuiWindow::event(QEvent*) () at  
/usr/lib64/libKF5XmlGui.so.5
#8  0x00005555555dc81c in KMyMoneyApp::event(QEvent*) (this=<optimized  
out>, event=<optimized out>) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/kmymoney.cpp:4194
#9  0x00007ffff69639af in QApplicationPrivate::notify_helper(QObject*,  
QEvent*) () at /usr/lib64/libQt5Widgets.so.5
#10 0x00007ffff5e80b38 in QCoreApplication::notifyInternal2(QObject*,  
QEvent*) () at /usr/lib64/libQt5Core.so.5
#11 0x00007ffff5e841c5 in  
QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*)  
() at /usr/lib64/libQt5Core.so.5
#12 0x00007ffff5ed33c3 in  () at /usr/lib64/libQt5Core.so.5
#13 0x00007ffff3d8c60b in g_main_dispatch (context=0x7fffdc005000) at  
../glib-2.72.1/glib/gmain.c:3417
#14 g_main_context_dispatch (context=0x7fffdc005000) at  
../glib-2.72.1/glib/gmain.c:4135
#15 0x00007ffff3d8c8c8 in g_main_context_iterate  
(context=context at entry=0x7fffdc005000, block=block at entry=1,  
dispatch=dispatch at entry=1, self=<optimized out>) at  
../glib-2.72.1/glib/gmain.c:4211
#16 0x00007ffff3d8c97f in g_main_context_iteration  
(context=0x7fffdc005000, may_block=1) at  
../glib-2.72.1/glib/gmain.c:4276
#17 0x00007ffff5ed2e54 in  
QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>)  
() at /usr/lib64/libQt5Core.so.5
#18 0x00007ffff5e7f51b in  
QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at  
/usr/lib64/libQt5Core.so.5
#19 0x00007ffff5e87b7d in QCoreApplication::exec() () at  
/usr/lib64/libQt5Core.so.5
#20 0x00005555555d702e in runKMyMoney(QApplication&, QUrl const&, bool)  
(a=<optimized out>, file=<optimized out>, noFile=<optimized out>) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/main.cpp:385
#21 0x00005555555d85e8 in main(int, char**) (argc=<optimized out>,  
argv=<optimized out>) at  
/var/tmp/portage/app-office/kmymoney-9999/work/kmymoney-9999/kmymoney/main.cpp:294

And here is the schedule as extracted from the xml file:
   <SCHEDULED_TX autoEnter="1" endDate="" fixed="1" id="SCH000039"  
lastDayInMonth="0" lastPayment="2022-06-01" name="Patreon Podcast"  
occurence="32" occurenceMultiplier="1" paymentType="8"  
startDate="2021-03-01" type="1" weekendOption="2">
    <PAYMENTS/>
    <TRANSACTION commodity="USD" entrydate="" id="" memo="833-9728766    
CA" postdate="2022-07-01">
     <SPLITS>
      <SPLIT account="A000370" action="" bankid="" id="S0001"  
memo="Patreon for Podcast" number="" payee="P000003" price="1/1"  
reconciledate="" reconcileflag="0" shares="-21/4" value="-21/4"/>
      <SPLIT account="A000043" action="" bankid="" id="S0002"  
memo="Patreon for Podcast" number="" payee="" price="1/1"  
reconciledate="" reconcileflag="0" shares="21/4" value="21/4"/>
     </SPLITS>
    </TRANSACTION>
   </SCHEDULED_TX>

So as Thomas suspected, this it trying to automatically enter this  
schedule, although I'm not sure why it would have tried that yesterday,  
one day early.  Also, I think (but cannot easily confirm) that this  
thrown error seemed to block KMM from trying to auto-enter other  
scheduled transactions on the same date.

Further clue: tracing through earlier phases of the enterSchedule chain  
(KScheduledViewPrivate::enterSchedule() at kscheduledview_p.h:202  
(approx line) the origDueDate, which is from schedule.nextDueDate()  
shows up as jd = 2459762.  This is an invalid Julian date, assuming  
that is what it is supposed to be.

I'm still digging through the code related to schedules, so I'm not  
totally stuck yet, although I don't currently have any useful ideas of  
what's going on.

Jack


More information about the KMyMoney-devel mailing list