You are not logged in.

#1 2023-03-14 13:06:45

raavas
Member
Registered: 2011-10-21
Posts: 86

[SOLVED] Tint2 crashing on startup

I have had this issue for a few days now. Tint2 crashes on startup. I did not change anything, just kept updating the system normally as a daily routine.

When attempting to restart manually from terminal, I get the following:

tint2: Using glib slice allocator (default). Run tint2 with environment variable G_SLICE=always-malloc in case of strange behavior or crashes
tint2: xRandr: Found crtc's: 2
tint2: xRandr: Linking output DVI-D-0 with crtc 0, resolution 1920x1200, DPI 94
tint2: xRandr: Linking output HDMI-0 with crtc 1, resolution 1920x1200, DPI 94
tint2: No XSETTINGS manager, tint2 uses config option 'launcher_icon_theme'.
tint2: Loading config file: /home/pekka/.config/tint2/tint2rc
tint2: real transparency off.... depth: 24
tint2: panel items: PTLSC
tint2: Systray composited rendering off
tint2: systray_asb forced to 100 0 0
tint2: nb monitors 2, nb monitors used 2, nb desktops 2
tint2: panel 1 uses scale 1 
tint2: Loading icon theme cache...
tint2: panel 2 uses scale 1 
tint2: Kernel uevent interface initialized...
tint2: systray window 23068688
tint2: systray started
add_icon: 18874395 (), pid 694, visual 0x55fd469d7d10, colormap 18874396, depth 32, width 20, height 20
tint2: Couldn't get geometry of window!
systray 823: cannot embed icon for window 18874395 () parent 23068803 pid 694
tint2: remove_icon: 18874395 ()
Segmentation fault (core dumped)

I am using Openbox.

Where should I look for answers?

Last edited by raavas (2023-03-16 19:09:57)

Offline

#2 2023-03-14 13:15:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Tint2 crashing on startup

Look at/post the coredump: https://wiki.archlinux.org/title/Core_d … _core_dump (the output from gdb followed by bt full is what's interesting)

Random guess tint2 doesn't like libx11 changes, more direct guess it mentions a very specific PID and window that it can't handle, which tool is causing these geometry issues here? What's pid 694 ?

Offline

#3 2023-03-14 19:07:06

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

It keeps changing the pid (now it is 1456), but I hope I got the relevant info:

Stack trace of thread 1456:
                #0  0x0000555feb5b91fb on_change_systray (tint2 + 0x251fb)
                #1  0x0000555feb5b95a4 resize_systray (tint2 + 0x255a4)
                #2  0x0000555feb5cbf90 relayout_fixed (tint2 + 0x37f90)
                #3  0x0000555feb5cbf45 relayout_fixed (tint2 + 0x37f45)
                #4  0x0000555feb5cc11d relayout (tint2 + 0x3811d)
                #5  0x0000555feb5af89e render_panel (tint2 + 0x1b89e)
                #6  0x0000555feb5b30e3 handle_panel_refresh (tint2 + 0x1f0e3)
                #7  0x0000555feb5b35ef run_tint2_event_loop (tint2 + 0x1f5ef)
                #8  0x0000555feb5b366f tint2 (tint2 + 0x1f66f)
                #9  0x0000555feb5a7095 main (tint2 + 0x13095)
                #10 0x00007f23d5bf6790 n/a (libc.so.6 + 0x23790)
                #11 0x00007f23d5bf684a __libc_start_main (libc.so.6 + 0x2384a)
                #12 0x0000555feb5a752e _start (tint2 + 0x1352e)
                ELF object binary architecture: AMD x86-64

In fact, all the coredumps are from the past 2 days and most involve tint2. I temporarily used xfce3-panel, and got two dumps from it too.

Last edited by raavas (2023-03-14 19:33:18)

Offline

#4 2023-03-14 21:23:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Tint2 crashing on startup

Of course the pid changes, which window/client in the systray is it ( ps -ef | grep 694 or whatever the pid leads to the geometry problem)? Some program you are using generates an invalid icon that dumps tint2 from what I'm seeing, which applications are you using that you'd expect an icon from?

FWIW from a couple of other reports glib2 is a likely culprit: https://bbs.archlinux.org/viewtopic.php?id=284285

Last edited by V1del (2023-03-14 21:31:21)

Offline

#5 2023-03-15 15:42:24

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

It is possible that Dropbox icon causes issues as it has resided in the top left corner since installing Arch and I could not get it out of there (certainly not to system tray!) no matter what. When I temporarily switched to xfce4-panel, that dropbox icon looked garbled, but was in the system tray.

Thanks for the info so far!

Offline

#6 2023-03-15 15:45:33

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: [SOLVED] Tint2 crashing on startup

You could of course try to take it up on the offer in the first line and start tint2 with G_SLICE=always-malloc exported.

Offline

#7 2023-03-15 16:31:44

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

V1del wrote:

You could of course try to take it up on the offer in the first line and start tint2 with G_SLICE=always-malloc exported.

The problem is (possibly) that gslice now always and only defaults to malloc
https://bbs.archlinux.org/viewtopic.php … 5#p2090135
https://git.pwmt.org/pwmt/girara/-/issues/17#note_2011
https://gitlab.gnome.org/GNOME/glib/-/c … 601e56c170

Online

#8 2023-03-15 19:43:18

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

V1del wrote:

You could of course try to take it up on the offer in the first line and start tint2 with G_SLICE=always-malloc exported.

I tried that with no luck.

Offline

#9 2023-03-15 20:18:35

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

1. Downgrade glib2
2. If that stabilizes xfce, try whether you can make it crash w/ the downgraded glib2 (< 2.76.0) and G_SLICE=always-malloc exported.

Exporting G_SLICE=always-malloc has no effect w/ 2.76.0, which *might* be the problem here.

Online

#10 2023-03-16 19:09:40

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

Downgrading glib2 seems to have solved the problem, thanks to everyone who commented! This works for me, marking as solved.

Offline

#11 2023-03-16 19:54:31

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

That's not gonna be a forever solution. glib2 won't fix, so unless they revert to the previous the g_slice behavior out of, i don't know, a minimal sense of responsibility to not go around and break stuff because tehy feel like and wrt

https://gitlab.com/o9000/tint2 wrote:

The final release of tint2 is 17.0.2.
The code is frozen and no more feature requests are accepted.

you'll probably have to look for a different bar (or fork tint and valgrind it until all memory errors are gone)

Online

#12 2023-03-17 19:05:26

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

I know, and I am already in process of whittling out which bar to try. I may even have to switch out of Openbox altogether, which I have used for years now. I don't want to keep ignoring glib2 or stand in the way of progress...

Do you have any recommendations on a WM/DE + bar combos?

Offline

#13 2023-03-17 21:30:55

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

Idk whether openbox is still somewhat maintained, but there're patch suggestions.
https://wiki.archlinux.org/title/Window … w_managers / blackbox and fluxbox are rather obvious alternatives.

If there're no tint2 patches (accepted, either up- or downstream):
https://wiki.archlinux.org/title/List_o … r#Taskbars

Online

#14 2023-03-19 19:35:08

timakro
Member
Registered: 2019-07-18
Posts: 7

Re: [SOLVED] Tint2 crashing on startup

I found another tint2 crash also caused by the glib2 release. I emailed a patch to the maintainer from the AUTHORS file. If I hear from them I'm sure we will also get a patch for your crash in.

Offline

#15 2023-03-19 19:54:06

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: [SOLVED] Tint2 crashing on startup

timakro wrote:

I found another tint2 crash also caused by the glib2 release. I emailed a patch to the maintainer from the AUTHORS file. If I hear from them I'm sure we will also get a patch for your crash in.

Maybe it would be a good idea to post the patch here in case the maintainer does not respond and somebody else encounters the same issue...

Last edited by karabaja4 (2023-03-19 19:54:30)

Offline

#16 2023-03-19 20:02:10

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

Let's hope so. It is proving difficult to find a suitable alternative for tint2.

Offline

#17 2023-03-19 20:08:28

timakro
Member
Registered: 2019-07-18
Posts: 7

Re: [SOLVED] Tint2 crashing on startup

I can reproduce the crash by resuming my system from suspend because this triggers some device hot plug events which are handled by this code. Here is the patch.

diff --git a/src/util/uevent.c b/src/util/uevent.c
index 1d0d11e..7a37453 100644
--- a/src/util/uevent.c
+++ b/src/util/uevent.c
@@ -157,7 +157,10 @@ void uevent_handler()
 
     struct uevent *ev = uevent_new(buf, len);
     if (ev) {
-        for (GList *l = notifiers; l; l = l->next) {
+        /* we might remove elements in the callback so a copy is needed */
+        GList *list = g_list_copy(notifiers);
+
+        for (GList *l = list; l; l = l->next) {
             struct uevent_notify *nb = l->data;
 
             if (!(ev->action & nb->action))
@@ -169,6 +172,7 @@ void uevent_handler()
             nb->cb(ev, nb->userdata);
         }
 
+        g_list_free(list);
         uevent_free(ev);
     }
 }

Offline

#18 2023-03-19 20:41:37

timakro
Member
Registered: 2019-07-18
Posts: 7

Re: [SOLVED] Tint2 crashing on startup

I'm pretty sure I have a patch for OP's crash but I can't test it, though "remove_icon" in the logs strongly suggests to me that this is it. There seems to be a pattern to these kinds of crashes: there is always a loop iterating over a GList with a code path that frees and removes and element from the GList. With the previous allocator it seems these elements lingered a while longer, long enough for the iteration to finish, while with the new iterator they get wiped immediately thus crashing on the next iteration. The fix is to iterate over a copy of the list.

EDIT: Removed patch because it's not fixing the issue.

Last edited by timakro (2023-03-21 14:48:32)

Offline

#19 2023-03-19 23:58:28

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: [SOLVED] Tint2 crashing on startup

timakro wrote:

there is always a loop iterating over a GList with a code path that frees and removes and element from the GList. With the previous allocator it seems these elements lingered a while longer, long enough for the iteration to finish, while with the new iterator they get wiped immediately thus crashing on the next iteration. The fix is to iterate over a copy of the list.

Do you know why exactly this happens?

Say you have a list A -> B -> C.

You iterate the list and on first iteration you remove C.

Now you have A -> B -> [  ].

On third iteration it will break.

Why does it matter if you are iterating a copy or an original? A list element is still removed and you're still trying to access something that's removed.

Last edited by karabaja4 (2023-03-19 23:58:49)

Offline

#20 2023-03-20 08:56:49

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

A list is (generically) a reference to a structure w/ two items (the payload, or a reference to it, and a reference to the next link - arrays are a special case of the concept because the next link reference is implicit)

L0 -> X,La -> Y,Lb -> Z,Lc -> E0L

If you only edit the list, but don't touch the payload, you end up w/

L0 -> X,Ld -> Z,Le -> Y,Lf -> E0L

So your previous Lb reference no longer references Z,Lc but an invalid memory segment.

In that case operating on a copy /can/ be a fix because that copy

L0 -> X,Lx -> Y,Ly -> Z,Lz -> E0L

doesn't get altered.

You however run into problems when
a) the alteration of the list is anticipated in the traversal (ie. you intended to continue on the re-arranged, extended or shortened list, not the original one)
b) the payload gets altered (because you now may still find the reference "Z", but it references garbage)
c) the altering code actually alters the traversed list, no matter what that is, rather than some global structure

(a) would have lead the behavior w/ the old glib2 to be broken (because you run into the same problem)
(b) would possibly have been covered by the old glib2 and NOT gotten fixed w/ the copy
c) makes the copy moot

Alternative approaches are to
a) repeatedly traverse the list from the beginning (re-starting immediately after an alteration) until no alteration is necessary
b) create a new list of elements (payload!) to act on and then act on them after the list has been traversed

(a) can lead to infinite repitition and (b) to undesired behavior (as w/ the copy approach)

There's no cookie-cutter solution: you need to understand what you want and what the pot. changes are to determine the correct approach.

A gerneral downside of the copy is that you introduce the copy cost ex ante (and unconditionally) what may cause quite some overhead w/ long lists or in hot loops and if 99.9% of the list inspection doesn't lead to any action.
One can defer the copy and only introduce it when the list gets actually altered (so you begin traversing the original list, at some point understand that you need to alter it, create the copy and move the iterator to the copy of the list to continue using it instead of the original list)

Online

#21 2023-03-20 09:42:48

timakro
Member
Registered: 2019-07-18
Posts: 7

Re: [SOLVED] Tint2 crashing on startup

Right, in my second patch (the one I didn't test) the items in the list also get freed so I suppose my patch is wrong. In my first patch it works because the items in the list point to static memory.

Last edited by timakro (2023-03-20 09:43:10)

Offline

#22 2023-03-21 19:35:24

raavas
Member
Registered: 2011-10-21
Posts: 86

Re: [SOLVED] Tint2 crashing on startup

The recent openbox update did not fix the glib2 issue. I need to downgrade it again.

Offline

#23 2023-03-21 20:04:12

karabaja4
Member
From: Croatia
Registered: 2008-09-14
Posts: 997
Website

Re: [SOLVED] Tint2 crashing on startup

raavas wrote:

The recent openbox update did not fix the glib2 issue. I need to downgrade it again.

The issue with Openbox has nothing to do with the tint2 issue, except they share a cause (glib2). You need a patched version of tint2 to stop the tint2 from crashing.

Offline

#24 2023-11-30 23:40:20

hazote
Member
Registered: 2013-07-24
Posts: 46

Re: [SOLVED] Tint2 crashing on startup

Hi,
My tint2 keep crashing after "a certain time".
how to apply patch please ?

Offline

#25 2023-12-01 08:04:16

seth
Member
Registered: 2012-09-03
Posts: 50,008

Re: [SOLVED] Tint2 crashing on startup

EDIT: Removed patch because it's not fixing the issue.

Since the g_slice drama happened > ½ a year ago, maybe share the backtrace to gage whether your crash falls into the same category and/or whether it's maybe already fixed upstream.
To apply any kind of patches, you'll have to add them to the PKGBUILD and build tint2 yourself.

Online

Board footer

Powered by FluxBB