2024-05-07 GnuCash IRC logs

01:30:03 *** fell has quit IRC
01:31:22 *** fell has joined #gnucash
01:31:23 *** ChanServ sets mode: +o fell
03:14:33 *** gjanssens has joined #gnucash
03:14:33 *** ChanServ sets mode: +o gjanssens
07:32:53 <Simon> my xml loading time on v5.6 is 75% of the loading time of v5.5
07:33:32 <Simon> can't reproduce any kind of "sort by" issue
07:34:36 <Simon> I can even close the tabs that have "sort by" popups open and it just closes those without crashing
07:44:12 *** warlord has joined #gnucash
07:44:12 *** gncbot sets mode: +o warlord
07:45:57 <Simon> gnc_quote_source_get_internal_name has been broken :/
07:46:47 <Simon> #0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:96
07:46:50 <Simon> #1 0x00007ff813b5f609 in SWIG_FromCharPtr (cptr=0x202d204120737361 <error: Cannot access memory at address 0x202d204120737361>) at /home/simon/src/gnucash-sa-build/bindings/python/gnucash_core.c:2997
07:46:52 <Simon> #2 0x00007ff813ba5230 in _wrap_gnc_quote_source_get_internal_name (self=<module at remote 0x7ff813c78a90>, args=<SwigPyObject at remote 0x7ff80d20d780>)
07:46:54 <Simon> at /home/simon/src/gnucash-sa-build/bindings/python/gnucash_core.c:22831
07:47:16 <Simon> looks like a random string is being returned as the pointer value, so something's not right
08:04:06 <Simon> 5d16d025a619e88a4c9d366a02b9c91c4fc34e2a is the first bad commit
08:08:39 <Simon> I think I may be getting a std::string* instead of a char*
08:44:53 <nevivurn> Hi, I filed a bug report regarding a segfault in test-lots at https://bugs.gnucash.org/show_bug.cgi?id=799289. 1) is that the correct place to report those? 2) I understand if this is lower-priority, do you folks accept patches? 3) I am not a great C++ programmer, I would greatly appreciate it if anyone had pointers to places I should look first
08:57:49 *** phebus has quit IRC
09:02:54 *** phebus has joined #gnucash
09:02:54 *** ChanServ sets mode: +v phebus
09:10:44 *** manis has quit IRC
10:00:53 <warlord> Simon, the compiler would prevent returning a std::string* in a function expecting a char*. OTOH, if the std::string goes out of scope, then even returning the std::string::str() would return invalid data.
10:35:17 *** chris has joined #gnucash
10:35:17 *** ChanServ sets mode: +v chris
10:35:17 *** gncbot sets mode: +o chris
10:38:58 <chris> Simon: how are you calling gnc_quote_source_get_internal_name from? a python script?
10:40:18 <chris> Simon: there are several xml loading time speedups in past 60days... My benchmarks improved from 7.5s to 3.5s
10:44:55 <Simon> chris: https://bugs.gnucash.org/show_bug.cgi?id=799305
10:50:07 <chris> Simon: thanks for the bug report. Would you be happy to add a test datafile please?
10:50:31 <chris> I understand the bug but not quite how to reproduce
11:04:36 <Simon> introduce exactly three <cmdty:quote_source/> that will be considered unknown
11:05:17 <Simon> assert that &new_quote_sources[0] hasn't changed when adding unknown sources 2 and 3
11:05:42 <Simon> of course it will need major refactoring to not store those in a std::vector, which will make it incompatible with the others
11:24:52 *** chris has quit IRC
12:03:01 *** jralls has joined #gnucash
12:03:01 *** ChanServ sets mode: +o jralls
12:05:44 <jralls> @tell chris With the std::vector<gnc_quoute_src> you can't save references to the vector's contents until the vector is done allocating. There are three potential fixes:
12:05:44 <gncbot> jralls: The operation succeeded.
12:06:41 <jralls> @tell chris 1: Get the count the unknown sources and reserve enough vector space to contain them all.
12:06:41 <gncbot> jralls: The operation succeeded.
12:08:59 <jralls> @tell chris 2: Make it a std::vector<std::unique_ptr<gnc_quote_src>> and return pointers to the contained gnc_quote_src*. Those will be constant even when the std::vector has to move its contents because of a realloc.
12:08:59 <gncbot> jralls: The operation succeeded.
12:12:58 <jralls> @tell chris 3: Return the gnc_quote_src's internal_name and always search for it when you need a gnc_quote_src*. This is the most robust. Note that you can do all three; #1 will provide a performance gain by reducing allocations, #2 will incur a performance hit by increasing them.
12:12:58 <gncbot> jralls: The operation succeeded.
12:25:02 <jralls> nevivurn Crashes always have top priority but all volunteers with limited time so it can take a while to work through the queue. We do gladly accept Github pull requests (preferred) or patches on bug reports, see https://wiki.gnucash.org/wiki/Development#Submitting_Patches.
12:29:50 <jralls> nevivurn Your Debian Valgrind dump points right at the issue: The "other" split has already been freed so trying to access it is a use-after-free. Ensure that the pointers followed by xaccSplitGetOtherSplit are being NULLed when the split is freed and that those dereference attempts are NULL-checked.
12:31:43 <jralls> nevivurn, even though we're using the C++ compiler on Account.cpp that code is very much C.
12:31:57 *** jralls has quit IRC
12:47:12 <Simon> The impact of allocating quote sources as a pointer is going to be negligible
12:47:48 <Simon> The main difficulty is the known quote sources being statically allocated which means they either have a different type or you allocate them at runtime too
15:55:29 *** gjanssens has quit IRC
18:41:57 *** fell has quit IRC
18:42:51 *** fell has joined #gnucash
18:42:52 *** ChanServ sets mode: +o fell
19:23:12 *** chris has joined #gnucash
19:23:12 *** ChanServ sets mode: +v chris
19:23:12 *** gncbot sets mode: +o chris
19:23:31 <chris> .
19:23:31 <gncbot> chris: Sent 7 hours and 17 minutes ago: <jralls> With the std::vector<gnc_quoute_src> you can't save references to the vector's contents until the vector is done allocating. There are three potential fixes:
19:23:32 <gncbot> chris: Sent 7 hours and 16 minutes ago: <jralls> 1: Get the count the unknown sources and reserve enough vector space to contain them all.
19:23:33 <gncbot> chris: Sent 7 hours and 14 minutes ago: <jralls> 2: Make it a std::vector<std::unique_ptr<gnc_quote_src>> and return pointers to the contained gnc_quote_src*. Those will be constant even when the std::vector has to move its contents because of a realloc.
19:23:34 <gncbot> chris: Sent 7 hours and 10 minutes ago: <jralls> 3: Return the gnc_quote_src's internal_name and always search for it when you need a gnc_quote_src*. This is the most robust. Note that you can do all three; #1 will provide a performance gain by reducing allocations, #2 will incur a performance hit by increasing them.
19:24:33 <chris> Simon jralls: yes, to reproduce it and fix it... would I force a vector reallocation via a crafted datafile, or via changing preferences or the environment?
19:26:51 <chris> Simon: most of the xml loading speedup comes from: (1) not creating temporary std::string to parse "num/denom" (2) no temporary std::string to parse iso-8859 datetime, (3) using from_chars to parse
19:27:38 <chris> (4) account splits->vector to reduce the impact of O(N^2) in gnc_account_insert_split to avoid adding dupe splits
19:32:16 *** chris has quit IRC
19:57:54 *** phebus has quit IRC
20:00:03 *** raghukamath has quit IRC
20:00:57 *** phebus has joined #gnucash
20:00:57 *** ChanServ sets mode: +v phebus
20:11:00 *** raghukamath has joined #gnucash
20:11:01 *** ChanServ sets mode: +v raghukamath
20:34:19 *** chris has joined #gnucash
20:34:19 *** ChanServ sets mode: +v chris
20:34:19 *** gncbot sets mode: +o chris
20:34:46 *** chris has quit IRC
21:52:04 *** arawakito has joined #gnucash
21:54:25 *** arawakito has left #gnucash
21:55:02 *** arawakito has joined #gnucash
21:58:12 *** arawakito has left #gnucash
21:58:53 *** arawakito has joined #gnucash
22:00:37 *** arawakito has left #gnucash