Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: Openbox leaking memory? (Read 2141 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: Openbox leaking memory?

Reply #15
I had issues with conky-1.19.7-1 myself. Allegedly 1.19.7-2 is a fix, but I think I had problems with that version because my attempts to fix the issues made me change to double_buffer = false,  I  had some problems after updating to 1.19.7-2 including a tint2 crash.

EDIT: I tried again with conky-1.19.7-2 and it causes a segfault in tint2 somehow

Code: [Select]
/home/robin/.config/openbox/autostart.sh: line 10:   604 Segmentation fault      (core dumped) /bin/tint2
reverting to conky-1.19.6-1 seems to make things better.

Not sure if this is of any use
Quote
                Stack trace of thread 604:
                #0  0x00005e442bd0f2f5 find_area_under_mouse (tint2 + 0x3d2f5)
                #1  0x00005e442bcf2216 n/a (tint2 + 0x20216)
                #2  0x00005e442bcf2796 handle_x_events (tint2 + 0x20796)
                #3  0x00005e442bcf28f5 run_tint2_event_loop (tint2 + 0x208f5)
                #4  0x00005e442bcf2a35 tint2 (tint2 + 0x20a35)
                #5  0x00005e442bce50ae main (tint2 + 0x130ae)
                #6  0x00007e146e3fdcd0 n/a (libc.so.6 + 0x25cd0)
                #7  0x00007e146e3fdd8a __libc_start_main (libc.so.6 + 0x25d8a)
                #8  0x00005e442bce5805 _start (tint2 + 0x13805)
               
                Stack trace of thread 617:
                #0  0x00007e146e4de88d syscall (libc.so.6 + 0x10688d)
                #1  0x00007e146ee0f337 g_cond_wait (libglib-2.0.so.0 + 0xb3337)
                #2  0x00007e146ed811b4 n/a (libglib-2.0.so.0 + 0x251b4)
                #3  0x00007e146ed8121c g_async_queue_pop (libglib-2.0.so.0 + 0x2521c)
                #4  0x00007e146eaa0c48 n/a (libpangoft2-1.0.so.0 + 0x8c48)
                #5  0x00007e146ede7a45 n/a (libglib-2.0.so.0 + 0x8ba45)
                #6  0x00007e146e46355a n/a (libc.so.6 + 0x8b55a)
                #7  0x00007e146e4e0a3c n/a (libc.so.6 + 0x108a3c)
                ELF object binary architecture: AMD x86-64

EDIT: seems upstream has this report


Re: Openbox leaking memory?

Reply #17
Small update: I haven't received any response yet on the issue, so I did some further testing.

Another Git Bisect was completely inconclusive (the commit that "introduced the bug" was one where only the version in the CmakeFile was changed) and I checked if IceWM had the same issue with the "cursor change test".

There was no issue, so it may be an interaction issue with OpenBox and Conky instead of being just a "Conky problem".

Re: Openbox leaking memory?

Reply #18
Well I think it depends on your point of view. I'm running conky on Arch linux and Artix. I see the problem occurs when I update conky from 1.19.6-1 to either of 1.19.7-1 or 1.19.7-2. Whatever conky is doing it is affecting tint2 (for me). A change in one breaks another. I think the change is responsible.

Re: Openbox leaking memory?

Reply #19
Well I think it depends on your point of view. I'm running conky on Arch linux and Artix. I see the problem occurs when I update conky from 1.19.6-1 to either of 1.19.7-1 or 1.19.7-2. Whatever conky is doing it is affecting tint2 (for me). A change in one breaks another. I think the change is responsible.

That is absolutely true, but I think that also other things should be considered: Openbox and Tint2 are officially unmaintained, thus they're not keeping up with the latest (possible) changes in the protocols (maybe used to fix bugs) or make use of workarounds that are just not there anymore.

That obviously doesn't exonerate Conky, as this issue may be symptom of a deeper problem that may, at the very minimum, warrant a look at.

 

Re: Openbox leaking memory?

Reply #20
Since wayland devs complain that xorg is unmaintained I doubt that any protocols have changed  recently.
If a protocol change external to openbox/tint2 has changed then it's probable that it would already have started  to affect tint2 with an earlier version of comky.

As conky development is attempting to provide a wayland version its more likely that a protocol assumption or change in conky has caused this problem. Also the conky devs could easily simulate this problem and just say what they regard as the real problem ie tint2 ignores x etc etc.


Re: Openbox leaking memory?

Reply #22
I didn't say X.Org was, but that's one of the assertions made by those pushing wayland and this article suggests there may be something in their claim.

X11 was released in 1984  and X.Org in 2004 if wikipedia is correct. After such a long time I think it's unlikely that they are changing anything fundamental.

However, it's so large that conky might be doing something perfectly legal, but which has an adverse effect on another app. The lack of isolation is another item on the wayland complaints list.

Re: Openbox leaking memory?

Reply #23
Sorry to be pedantic but when something was released has no bearing on whether something fundamental can still change. Linux was released in 1991.

Commits (just xserver) since the article you posted
Quote
git rev-list --count --since="2022-12-30" HEAD                                                                                                               [16:09:39]
465
Anyone of which has the potential to introduce a bug or regression.
I'm not saying that Xorg is the cause. Just that I think your logic ruling it out is flawed.

Re: Openbox leaking memory?

Reply #24
Sorry to be pedantic but when something was released has no bearing on whether something fundamental can still change. Linux was released in 1991.

Commits (just xserver) since the article you posted
Quote
git rev-list --count --since="2022-12-30" HEAD                                                                                                               [16:09:39]
465
Anyone of which has the potential to introduce a bug or regression.
I'm not saying that Xorg is the cause. Just that I think your logic ruling it out is flawed.
You are quite correct. I suppose I should check if conky-1.19.7 works with much older xorg-server.

Re: Openbox leaking memory?

Reply #25
Xorg is not without defects, for instance it has two different helper librarie sets: Xlib and XCB. One is dated, the other is not-that-well-documented. (I'm oversimplifying).

The Client/Server model may seem outdated (although I personally have no issue with it, from an architectural point of view).

But Wayland is being pushed too hard and too quickly in my humble opinion (I don't really like the fact that each app has to render its own content, I fear we'll end up having one way of rendering windows for each graphical toolkit in existence). But that's off-topic.

It seems to me that the origin of both mine and replarobin's bugs are rooted in the new mouse event management:

- Seems that tint2 crashes (according to the github issue) when the mouse goes over Conky
- Seems that my OpenBox session starts getting really mad when I change my mouse cursor (and other random times that may be related to mouse events?)

There have been a lot of changes happening, both on Conky, Tint2 and Xorg. I don't think Xorg can be excluded, being a some kind of "mediator between everything", just yet.

It stands to reason that my issue happens only with OpenBox and not FluxBox or IceWM, which means it's limited to 3 components: Xorg, OpenBox and Conky. I can't remove Xorg, but if I remove either of the other 2, the issue disappears.

I will try a new bisect soon and see if I get to the same result as the last one.

Re: Openbox leaking memory?

Reply #26
Followed the excellent advice of gripped above and decided to check what happens with an older xserver I set the archive date at 21//12/2023 (day before the conky-1.19.6-1 release). Then installed the xserver & conky-1.19.7-2 packages and restarted. I still  see the tint2 crash with these, but it seems to take a bit longer to excite it.

Code: [Select]
robin@minikat:~
$ packer -Qs xorg-server
local/xorg-server 21.1.10-1 (xorg)
    Xorg X server
local/xorg-server-common 21.1.10-1 (xorg)
    Xorg server common files
local/xorg-server-utils 7.6-4
    Transition package depending on xorg server utilities
local/xorg-server-xvfb 21.1.10-1 (xorg)
    Virtual framebuffer X server
robin@minikat:~
$ packer -Qs conky
local/conky 1.19.7-2
    Light-weight system monitor for X, Wayland, and other things, too

Re: Openbox leaking memory?

Reply #27
Followed the excellent advice of gripped above ...

lol,

it would be far better to rebuild tint2.
"Wer alles kann, macht nichts richtig"

Artix USE="runit openrc slim openbox lxde gtk2 qt4 qt5 qt6 conky
-gtk3 -gtk4 -adwaita{cursors,themes,icons} -gnome3 -kde -plasma -wayland "

Re: Openbox leaking memory?

Reply #28
Followed the excellent advice of gripped above ...

lol,

it would be far better to rebuild tint2.
Easy to say, but I'm not a real expert. I think the code that fails is 
Code: [Select]
Area *find_area_under_mouse(void *root, int x, int y)
{
    Area *result = root;
    Area *new_result = result;
    do {
        result = new_result;
// EDIT: I inserted here
Code: [Select]
 if(!result) break;
        GList *it = result->children;
        while (it) {
            Area *a = (Area *)it->data;
            if (area_is_under_mouse(a, x, y)) {
                new_result = a;
                break;
            }
            it = it->next;
        }
    } while (new_result != result);
    return result;
}
the failure for me is a segfault so I assume that one of  the -> ops fails. I think that must be the result->children ie result has become NULL. I will try returning result  if result is NULL.

[EDIT:] I inserted if(!result) break; At line 2 of the do {} while loop. I installed that version of tint2 and it seemed to be OK with conky-1.19.6-1 and also has not crashed with conky-1.19.7-2. I'm just not sure if that is patching a bug in conky or if the original tint2 code is making a wrong assumption.

EDIT 2: if the tint2 fix is thought to be a good thing how should we/I proceed? I assume the PKGBUILD is originally in Arch so a patch needs to be added there as tint2 is now considered finished (The final release of tint2 is 17.0.2.The code is frozen and no more feature requests are accepted.) so should I submit a patch to the Arch maintainer?

EDIT 3: sadly after two days I again see a crash in tint2 when running with conky-1.19.7-2. The SEGV happens in something in tint2 called from handle_x_events.  It's whackamole time :(

Re: Openbox leaking memory?

Reply #29
Hi everyone. I have solved this issue (as good as it gets for now).
The problem isn't exactly with Conky or (openbox from this thread), because it's Tint2 that's crashing (from what I have gathered).
This fix is only for Tint2 crashing, Conky is working fine for me.

This line will fix the problem int tint2

   if((e->type==4 || e->type==5 ||  e->type==6) && e->xproperty.window==server.root_win)
        return;

Insert it after line 420 in main.c  (source of tint2 from github) to modify the  handle_x_event function.

You will have to ofcourse compile and install tint2 again.

I hope it helps



As for the explanation of the problem and fix (I will try my best here)

For whatever reason that I have not fully investigated yet, hovering or clicking on Conky on your desktop triggers a certain kind of event in tint2 which gets poorly handled.

Normally in tint2 the Desktop events are handled fine as they have a different "type" assigned to them, but conky triggers them with type 4 or 5 or 6 (hover, press and release) and window id of the root window. The segfault happens with a null panel is returned and the event handler tries to iterate on it.

My code will make tint2 ignore these events involving conky

My suspicion is that the real problem might be elsewhere like in Conky or Xlib because other widgets on my desktop don't trigger the event in the same way. I have a weather widget and notes widget on my desktop that don't cause tint2 to crash.

This may also have something to do with the settings in conkyrc,  mine has the settings

own_window yes
own_window_type 'desktop'

For various reasons like appearance tastes, my conky rc settings let conky blend into the desktop and doesn't show up in the taskbar.
Sine I don't want to change my conky appearance preferences, this will patch the problems with tint2


Let me know if it works out for you guys.

Thanks