Bug 407854 - Solver is slow and logs too much to ~/.xsession-errors
Summary: Solver is slow and logs too much to ~/.xsession-errors
Status: RESOLVED FIXED
Alias: None
Product: kpat
Classification: Applications
Component: solver (show other bugs)
Version: 20.04
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Stephan Kulow
URL:
Keywords:
: 408708 409602 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-05-23 05:37 UTC by DHCP Easyness
Modified: 2023-01-18 10:00 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DHCP Easyness 2019-05-23 05:37:04 UTC
SUMMARY
In the newer version of kpat (starting with Kubuntu 19.04), solver is much slower, hogs CPU, and logs a_lot to .xsession-errors (as much as 500K per second)

STEPS TO REPRODUCE
1. Start kpat.
2. Start a monitor for CPU and ~/.xsession-errors
3. Start a new game that stress the solver, like Mod3 or Spider

OBSERVED RESULT
Observe the too much logging, CPU hogging, and slow solver

EXPECTED RESULT
Solver should not log (so much?) calculations to ~/.xsession-errors (for non-debug?). Solver should be faster (like in older versions of Kubuntu) and not spend so much time Calculating...

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: Kubuntu 19.04
(available in About System)
KDE Plasma Version: 5.15.4
KDE Frameworks Version: 5.56.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION
You can reproduce this from a Kubuntu 19.04 Live CD

Bug doesn't happen in Freecell and maybe some other games, so probably is different than these two bugs:  https://bugs.kde.org/show_bug.cgi?id=405187 and https://bugs.kde.org/show_bug.cgi?id=406094
Comment 1 trent 2019-07-08 05:10:51 UTC
Hi,

I also see a lot of logs to ~/.xsession-errors

I apologise to the maintainers, the fuzzy-search when I was submitting bug 409602 did not find this bug, but I have a similar issue (too many logs in `~/.xsession-error`?!? of all files, why not `/var/log/kpat/...`?).
Comment 2 Albert Astals Cid 2019-07-08 21:50:50 UTC
*** Bug 409602 has been marked as a duplicate of this bug. ***
Comment 3 DHCP Easyness 2019-11-06 22:25:13 UTC
I can confirm this is still a bug in Kubuntu 19.10 released last month.

Can't run kpat games mod3 or spider unless a big hard drive for ~/.xsession-errors so disk won't full.

SOFTWARE/OS VERSIONS
Windows: N/A
macOS: N/A
Linux/KDE Plasma: Kubuntu 19.10
(available in About System)
KDE Plasma Version: 5.16.5
KDE Frameworks Version: 5.62.0
Qt Version: 5.12.4

ADDITIONAL INFORMATION
You can reproduce this from a Kubuntu 19.10 Live CD
Comment 4 coleclough.lucy 2020-04-04 14:39:55 UTC
Hi there, I was going to report my error, but this resembles my bug closely enough. 
I am on debian 11 testing with kPat 4.19
The solver fills up /var/log/messages insanely quickly, causes 100% cpu and fills up hd space. 

Disabling prevents this issue
Comment 5 Kai Uwe Broulik 2020-04-09 07:02:36 UTC
I can confirm with my distro-provided package on neon.

When I build it locally, I only get this issue on a Debug build, not on Release. So I wonder if maybe kpat gets built as debug build or some other non-Release configuration for some reason?
Comment 6 Bernhard Rosenkränzer 2020-05-22 00:57:27 UTC
The problem is the fprintf(stderr) spewage in Solver::get_moves in patsolve/patsolve.cpp -- it's disabled only if built with -DNDEBUG.

For now we're fixing this in the OpenMandriva package by adding -DNDEBUG to the compiler flags. Given how much spewage it can cause (we found this bug after getting reports of a 20 GB xsession-errors.log), probably the #ifndef NDEBUG should be changed to something like #ifdef EXCESSIVE_DEBUG to fix it for everyone.
Comment 7 Bernhard Rosenkränzer 2020-05-22 00:59:39 UTC
Verified both the bug and the suggested fix from my previous comment in 20.04.1, changing version
Comment 8 Albert Astals Cid 2020-06-07 09:00:31 UTC
Git commit 9b1d9abdc56f5037e713e1fdefa22e58d5c2087a by Albert Astals Cid.
Committed on 30/05/2020 at 17:16.
Pushed by aacid into branch 'release/20.04'.

Change some verbose debugs from using ifndef NDEBUG

Lots of distributions are building with DebugAndRelease configurations
to have better symbols and it seems this debug is *so* verbose that
floods people's disks with data

M  +1    -1    dealer.cpp
M  +1    -1    patsolve/patsolve.cpp

https://invent.kde.org/games/kpat/commit/9b1d9abdc56f5037e713e1fdefa22e58d5c2087a
Comment 9 Stephan Kulow 2023-01-18 10:00:38 UTC
*** Bug 408708 has been marked as a duplicate of this bug. ***