Segfault in app_indicator_set_icon_full [patch attached]

Bug #1867996 reported by Paul G
64
This bug affects 12 people
Affects Status Importance Assigned to Milestone
libappindicator (Ubuntu)
Fix Released
Medium
Marco Trevisan (Treviño)
Bionic
Fix Released
Medium
Marco Trevisan (Treviño)

Bug Description

[ Impact ]

Discord and several other applications using libappindicator are widely reported to have been crashing for several years. See: https://github.com/flathub/com.discordapp.Discord/issues/30 (and others)

[ Test case ]

- Run discord application
- It must not crash in ubuntu (or when indicators are enabled)

[ Regression potential ]

Very low, icons might not appear in some cases, if any.

-----

This is the backtrace:
(gdb) bt full
#0 0x00007fe1d5d2e00e in () at /app/lib/libappindicator.so
#1 0x00007fe1f5a6f3c5 in g_closure_invoke () at /lib/libgobject-2.0.so.0
#2 0x00007fe1f5a813d2 in () at /lib/libgobject-2.0.so.0
#3 0x00007fe1f5a8a02c in g_signal_emit_valist () at /lib/libgobject-2.0.so.0
#4 0x00007fe1f5a8a40f in g_signal_emit () at /lib/libgobject-2.0.so.0
#5 0x00007fe1d5d2ed4f in app_indicator_set_icon_full () at /app/lib/libappindicator.so
#6 0x000000000077851a in ()
#7 0x0000000001de7123 in ()
#8 0x0000000001e4bd4e in ()
#9 0x0000000001e6e34c in ()
#10 0x0000000001e6e668 in ()
#11 0x0000000001e6e9cb in ()
#12 0x0000000001df971a in ()
#13 0x00007fe1f354b1c7 in g_main_context_dispatch () at /lib/libglib-2.0.so.0
#14 0x00007fe1f354b430 in () at /lib/libglib-2.0.so.0
#15 0x00007fe1f354b4dc in g_main_context_iteration () at /lib/libglib-2.0.so.0
#16 0x0000000001df9606 in ()
#17 0x0000000001e6e0e7 in ()
#18 0x0000000001e29570 in ()
#19 0x0000000000c37ec8 in ()
#20 0x0000000000c37d15 in ()
#21 0x0000000000c1da7d in ()
#22 0x0000000000a9282e in ()
#23 0x00000000007892d4 in ()
#24 0x00000000007896e0 in ()
#25 0x0000000003b830a3 in main ()

Happens in all versions of libappindicator built from latest sources available on launchpad.

I ran into the issue yesterday when installing Discord for the first time. I have tracked the problem down to libappindicator passing in an extra vararg item to g_signal_emit that the signal's definition in libappindicator was not declaring, causing the crash you see above in gobject's g_signal dispatch machinery.

Patch is attached.

I am presuming this is 'upstream' for libappindicator, whatever that may mean for what appears to be an unmaintained project. If it is not, and since it is an Ubuntu/Canonical-sourced project originally, I respectfully request that you assist in upstreaming it since this bug is causing severe breakage for users across all distros.

Revision history for this message
Paul G (paulieg) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Stop passing in undeclared boolean vararg" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Paul G (paulieg) wrote :

So, the patch is wrong. It fixes *a* bug, but not *the* bug. There appear to be multiple g_signal_emit calls that don't match the definition of the g_signals they're emitting. See: https://bugs.archlinux.org/task/65885

Unless I'm missing something, they all need to be fixed. I will audit them all, put together a patch, test it and report on results. Absent feedback from someone who actually knows g_signals and gobject in general, this ought to show whether I've misunderstood something or not.

Revision history for this message
Paul G (paulieg) wrote :

I've gone through the code and cleaned up all g_signal_emit and g_signal_new calls so they correspond with each other and make sense. No external API changes. Wrote up a simple test program to exercise the basic functionality, and used things like blueman-tray to confirm other edge functionality works. No longer crashes, signals to change status work and so on New patch attached.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in libappindicator (Ubuntu):
status: New → Confirmed
Revision history for this message
ash (sersorrel) wrote :

fwiw, that patch (or at least a slightly modified version which applies on the Ubuntu 18.04 libappindicator) appears to fix the Discord segfaults for me, and also looks correct from my reading of the gobject documentation.

Revision history for this message
ash (sersorrel) wrote :

correction: I also need to apply this patch in order to fix the segfaults for me.

Revision history for this message
Ian Whitlock (gigawhitlocks) wrote :

Applying both segfault_fix.patch and n_elements.patch seems to have cleared up these segfaults for me.

Changed in libappindicator (Ubuntu):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
status: Confirmed → Fix Committed
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libappindicator - 12.10.1+20.04.20200408.1-0ubuntu1

---------------
libappindicator (12.10.1+20.04.20200408.1-0ubuntu1) focal; urgency=medium

  [ Paul G ]
  * app-indicator: Don't pass unexpected parameter to signal emissions
    (LP: #1867996)

  [ Ash Holland ]
  * app-indicator: Only check for item numbers when iterating array
    (LP: #1867996)

 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 08 Apr 2020 18:58:49 +0000

Changed in libappindicator (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
ash (sersorrel) wrote :

It seems like there is still an unresolved issue with Discord after applying these patches: https://github.com/flathub/shared-modules/pull/96#issuecomment-608084182

though I don't know if the issue is caused by libappindicator or if it's a Discord problem that's exposed by the libappindicator-induced crashes being fixed.

Revision history for this message
Zach (despawned) wrote :

Hi,

Yes, what Ash linked is correct. I am the person who's comment is linked in Ash's comment, and after applying these patches, a new bug is created. After being in a voice call for a long period of time, discord animations will start to progressively lag severely when audio input is received. When you are not talking (mic activated) or your mic is muted, the lag does not occur, however, when typing and talking it is SEVERE. There must be something in these patches that causes high resource consumption (not necessarily ram/cpu) when voice is activated for long periods of time.

Revision history for this message
Paul G (paulieg) wrote :

This is getting far too confusing because multiple patches for multiple bugs are being conflated. I produced a fairly straightforward patch that fixed an issue I directly saw in people's backtraces, and other issues I identified that are similar. This is what this bug report is for.

The later patch that supposedly fixes something else is not mine, hasn't been tested by me, purports to solve an issue I personally haven't seen in a way that has no similarities to the bug I opened this report for (other than it occurs in Discord as well). Please open a separate bug report with backtraces that demonstrate *that* problem, and with *that* patch attached.

This avoids confusion and possible backing out of my patch together with the second, unrelated patch in case said unrelated patch has introduced a new problem.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Both patches have been applied, so no need for further bug. cfr https://bazaar.launchpad.net/~indicator-applet-developers/libappindicator/trunk/revision/295

Revision history for this message
TimSC (timsc) wrote :

I created PPA for libappindicator trunk (on 2020-06-02) for 18.04 and 20.04, as in interim measure: https://launchpad.net/~timsc/+archive/ubuntu/libappindicator and this seems to work for me with discord (at least for a 2 hour call).

Strangely, my system didn't detect it as a update, so I manually did:

sudo apt-get install libappindicator1=12.10.1+18.04.20200601.1-0ubuntu1

Probably something to do with package version numbers but I don't understand what.

Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

The fix is already in 20.04, while for 18.04 you can use the packages in https://launchpad.net/~ci-train-ppa-service/+archive/4009/+packages while the SRU team looks at the fix in queue for some time now.

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Paul, or anyone else affected,

Accepted libappindicator into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/libappindicator/12.10.1+18.04.20200408.1-0ubuntu1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in libappindicator (Ubuntu Bionic):
status: New → Fix Committed
tags: added: verification-needed verification-needed-bionic
Changed in libappindicator (Ubuntu Bionic):
assignee: nobody → Marco Trevisan (Treviño) (3v1n0)
Revision history for this message
Brian Murray (brian-murray) wrote : [libappindicator/bionic] verification still needed

The fix for this bug has been awaiting testing feedback in the -proposed repository for bionic for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Revision history for this message
ash (sersorrel) wrote :

tested with libappindicator 12.10.1+18.04.20200408.1-0ubuntu1 from -proposed on 18.04, Discord appears to be stable after multiple hours in a call. no regressions observed (other applications' indicators are still present).

tags: added: verification-done-bionic
removed: verification-needed-bionic
Mathew Hodson (mhodson)
tags: removed: removal-candidate verification-needed
affects: libappindicator (Arch Linux) → ubuntu-translations
no longer affects: ubuntu-translations
Changed in libappindicator (Ubuntu):
importance: Undecided → Medium
Changed in libappindicator (Ubuntu Bionic):
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libappindicator - 12.10.1+18.04.20200408.1-0ubuntu1

---------------
libappindicator (12.10.1+18.04.20200408.1-0ubuntu1) bionic; urgency=medium

  [ Paul G ]
  * app-indicator: Don't pass unexpected parameter to
    ::new-icon-theme-path signal (LP: #1867996)

  [ Ash Holland ]
  * app-indicator: Only check for item numbers when iterating array
    (LP: #1867996)

 -- Marco Trevisan (Treviño) <mail@3v1n0.net> Wed, 08 Apr 2020 18:59:25 +0000

Changed in libappindicator (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for libappindicator has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.