Crash due to fd leak when playing sounds in pidgin

Bug #1479715 reported by errors.ubuntu.com bug bridge
86
This bug affects 8 people
Affects Status Importance Assigned to Milestone
pidgin (Ubuntu)
Fix Released
High
Unassigned
Wily
Fix Released
High
Unassigned

Bug Description

The Ubuntu Error Tracker has been receiving reports about a problem regarding pidgin. This problem was most recently seen with version 1:2.10.11-0ubuntu4, the problem page at https://errors.ubuntu.com/problem/7470d12c4e88f72501f718f2e8fd6469b2cb650f contains more details.

Upstream bug: https://developer.pidgin.im/ticket/16752

Partial backtrace:

#0 0x00007f0e72819b24 in g_source_attach (source=source@entry=0x0, context=0x0) at /build/glib2.0-ajuDY6/glib2.0-2.46.1/./glib/gmain.c:1163
#1 0x00007f0e74b848b8 in gst_bus_add_watch_full_unlocked (bus=<optimized out>, priority=<optimized out>, func=0x56004c7ceeb0 <bus_call>, user_data=0x56004e00aa40, notify=0x0) at gstbus.c:885
#2 0x00007f0e74b849e0 in gst_bus_add_watch_full (bus=0x7f0e14009260 [GstBus], priority=0, func=0x56004c7ceeb0 <bus_call>, user_data=0x56004e00aa40, notify=0x0) at gstbus.c:936
#3 0x000056004c7cfb3a in pidgin_sound_play_file (filename=<optimized out>)
    at /build/pidgin-hiYwOJ/pidgin-2.10.11/./pidgin/gtksound.c:543
#4 0x000056004c7cf927 in pidgin_sound_play_event (event=PURPLE_SOUND_SEND)
    at /build/pidgin-hiYwOJ/pidgin-2.10.11/./pidgin/gtksound.c:616

[Impact]

* Each sound played will leak a file descriptor.

* Crash (null pointer dereference) after playing sounds roughly 1000 times (depending on fd limit)

* Depending on the amount of activity, this can mean every few hours for some users (it's once for each received or sent message)

[Test Case]

1. Set the file descriptor limit low enough to be able to login, plus a few extra. "ulimit -Sn 20" works for me
2. Start pidgin
3. Tools menu -> preferences -> sounds tab
4. Click "preview" 10 times or so
5. Acquire crash

[Regression Potential]

* The fix consists in adding two lines, returning FALSE when a sound finishes playing or when an error happens, which tells gstreamer to free those file descriptors, so it's highly unlikely that this could make things worse.

* A user who reported this bug yesterday was given a .deb file with the fix, who also distributed that fixed .deb to other 50 users who also had the issue in ubuntu wily. Everyone is happy now.

[Other Info]

* This fix will be included in pidgin 2.10.12, set to release very soon.

* The bug originally happened because of the backported gstreamer 1.0 patch that was also introduced in post-2.10.11 development versions.

Revision history for this message
dx (dx) wrote :
description: updated
summary: - /usr/bin/pidgin:11:g_source_attach:gst_bus_add_watch_full_unlocked:gst_bus_add_watch_full:pidgin_sound_play_file:pidgin_sound_play_event
+ Crash due to fd leak when playing sounds in pidgin
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in pidgin (Ubuntu):
status: New → Confirmed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "remove-gstreamer-pipeline-after-playing-a-sound-902b1fd.diff" 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
Changed in pidgin (Ubuntu):
importance: Undecided → High
Revision history for this message
dx (dx) wrote :

Created bug 1529445, which is about a different fd leak in gstreamer 1.6.0 itself that can result in the exact same crash in pidgin as this bug.

It's not as straightforward as this bug in that it doesn't leak constantly for all users, but requires, for example, not having a sound card or some other error to play sounds (that's two different reports from users who got crashes).

Mentioning this here mostly because until today I thought this was yet another bug in pidgin that wasn't fixed, but no, it's a problem in gstreamer. Or rather, ubuntu in general, which doesn't do SRUs of bugfix-only releases until someone decides to point out that it's critical enough. *sigh*. Don't mind me, it's like 4am and I feel like I wasted most of my day with this dumb issue.

Revision history for this message
Richard-purdie-1 (richard-purdie-1) wrote :

I ran into the same issue.

To improve searchability for this, the messages you see on the console from this are:

ERROR: cannot create wakeup pipe

(Pidgin:8924): GStreamer-CRITICAL **: gst_poll_get_read_gpollfd: assertion 'set != NULL' failed

(Pidgin:8924): GStreamer-CRITICAL **: gst_poll_write_control: assertion 'set != NULL' failed

(Pidgin:8924): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 24:Too many open files

(Pidgin:8924): GStreamer-CRITICAL **: gst_poll_free: assertion 'set != NULL' failed

Revision history for this message
Cysioland (cysioland) wrote :

I see it nominated for wily, but it occurs in wily.

Revision history for this message
dx (dx) wrote :

That's how bugs work here. They start as something for development versions only and then they are nominated to be fixed in stable releases.

Revision history for this message
Bert van der Horst (bert-vdrhorst) wrote :

Would disabling sound in Pidgin be a usefull workarround?

Revision history for this message
Cysioland (cysioland) wrote : Re: [Bug 1479715] Re: Crash due to fd leak when playing sounds in pidgin

It could, but it would be unpleasant, as people like, when thet get an
audible "ping" when they've got a message.

Revision history for this message
Pablo Sichert (pablo.sichert) wrote :

Disabling all sounds but "Message received" and "Attention received" is the
best workaround for now - the amount of sounds are reduced to a fraction
compared to enabling online notifications and messages sent sounds.

Revision history for this message
Paul Smith (psmith-gnu) wrote :

A fix for this has been sitting in wily-proposed for about 3 weeks now. I have no idea what it takes to get through that into a regular update. It's been handled as Bug #1529445 so look there for more details. Maybe someone knows how to move it forward through the process?

Revision history for this message
Sebastien Bacher (seb128) wrote :

> I have no idea what it takes to get through that into a regular update.

it needs somebody to install the update and verify it works as it should/fixes the problem it's supposed to/doesn't create regression and then comment back on launchpad saying that...

Revision history for this message
dx (dx) wrote :

I haven't had access to my dev computer for a few weeks so I couldn't test that wily-proposed package yet. I would appreciate if someone else did - the test case in the description is fairly easy to set up, IMO.

However, note that bug #1529445 is not the same thing as this bug - the wily-proposed package won't fix this.

This bug is about a very specific fd leak introduced in ubuntu patches to pidgin 2.10.11. In wily this should be fixed with the attached patch. In xenial, by upgrading to 2.10.12 and removing those local gstreamer 1.0 patches.

The other bug is about completely different gstreamer fd leaks that in rare situations may have the same effect with pidgin.

The gstreamer leaks are less frequent. The ones from this bug happen on every sound that is played.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the report and sorry for the delay, I'm updating xenial and uploaded a SRU for wily

Changed in pidgin (Ubuntu Wily):
importance: Undecided → High
status: New → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello errors.ubuntu.com, or anyone else affected,

Accepted pidgin into wily-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/pidgin/1:2.10.11-0ubuntu4.1 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 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, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

tags: added: verification-needed
Revision history for this message
dx (dx) wrote :

Okay got my dev pc back and tested this.

The test case in the description is passing with the wily-proposed package, 2.10.11-0ubuntu4.1

Had to adjust the fd limit i originally suggested for the test to be more reliable - 20 was a bit too low and was sometimes failing during startup even, so I used 40 instead - but it always returns to the original number so there's no leak.

Also tested in combination with the new gstreamer packages, and in a VM with no sound - I think that covers every known fd leak source.

Thanks!

tags: added: verification-done
removed: verification-needed
Changed in pidgin (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pidgin - 1:2.10.11-0ubuntu4.1

---------------
pidgin (1:2.10.11-0ubuntu4.1) wily; urgency=medium

  * debian/patches/hg_gst_leak.patch:
    "When receiving an error or stream finished message, we can free the
     Gstreamer pipeline so we don't leak it for each sound." (lp: #1479715)

 -- Sebastien Bacher <email address hidden> Tue, 23 Feb 2016 11:38:09 +0100

Changed in pidgin (Ubuntu Wily):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for pidgin has completed successfully and the package has now been 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.