update hooks infinite recursion makes kded5 use excessive memory

Bug #1434226 reported by Luis Silva
112
This bug affects 23 people
Affects Status Importance Assigned to Milestone
kubuntu-notification-helper (Ubuntu)
Fix Released
High
Harald Sitter

Bug Description

After upgrading to vivid kded 5 started randomly crashing. There were also severe delays as my disk was permanently spinning like some huge amount ao data was being read/written. The problem seems to be that without any warning and aparent cause, kded5 goes from using 204MB of memory to using all of the available memory and then some swap and finally crashing. This seems to happen at least once every half an hour. The latest updates to frameworks 5.8.0 does not seem to help.

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

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

Changed in kded (Ubuntu):
status: New → Confirmed
Revision history for this message
Oscar (orojas518) wrote :

Confirming this, after some minutes of use kded5 starts using all available RAM and makes the system unusable.

I decided to do a quick debugging and used cgroups to limit kded5 memory usage (to prevent it from freezing everything) and started paying attention to the memory usage on KSysGuard, when memory usage started increasing without control I sent an interrupt signal to the process and attached gdb, and well, there it was, over 2000 calls to Hook::getField from kded_notificationhelper.so which is provided by package kubuntu-notification-helper. I took a look at the source, and I noticed that after appending part of the locale to the field name it calls itself again and again. I made a quick patch to the source code and now the problem seems to have disappeared, however, I still don't understand why this problem didn't happen before, I only started experiencing this 3 days ago...

affects: kded (Ubuntu) → kubuntu-notification-helper (Ubuntu)
summary: - kded5 suddenly grabs all the available memory and crashes
+ infinite recursion makes kded5 use excessive memory
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote : Re: infinite recursion makes kded5 use excessive memory

The attachment "Gets rid of recursion by calling another function to actually search for the field in m_fields" 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
Rohan Garg (rohangarg) wrote :

Please submit this patch upstream to KDE for review.

Revision history for this message
Oscar (orojas518) wrote :

How exactly? Sorry, I'm new here... Also, please notice that this is a bug in kubuntu-notification-helper (kded_notificationhelper.so), not in kded5.

Revision history for this message
Rohan Garg (rohangarg) wrote :

Ah, sorry, I didn't read the bug report properly, I'll assign Harald who can look into it on Monday

Changed in kubuntu-notification-helper (Ubuntu):
assignee: nobody → Harald Sitter (apachelogger)
Revision history for this message
Jason Straight (jason-jeetkunedomaster) wrote :

This just started with mine today, after updates.

Philip Muškovac (yofel)
Changed in kubuntu-notification-helper (Ubuntu):
importance: Undecided → High
milestone: none → ubuntu-15.04
tags: added: kubuntu
Revision history for this message
Harald Sitter (apachelogger) wrote :

I feel like this change needs a unit test

Jonathan Riddell (jr)
summary: - infinite recursion makes kded5 use excessive memory
+ update hooks infinite recursion makes kded5 use excessive memory
Revision history for this message
Luke Johnstone (john-wella) wrote :

What a disaster this has been today. Completely hanging the system after a few minutes after login. Removed the package 'kubuntu-notification-helper' and I was able to use my system again. Not sure what kind of ill effects this could have, but a crash is better than an unresponsive computer :(

Revision history for this message
Wojciech Wieckowski (xplwowi) wrote :

After yesterday's system update plasma runs smoothly only ~2 minutes. After that kded5 eats all ram and swap file and freezes the system. I had to switch to openbox which is a real pain.

Jonathan Riddell (jr)
Changed in kubuntu-notification-helper (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Jonathan Riddell (jr) wrote :

fix uploaded

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

This bug was fixed in the package kubuntu-notification-helper - 15.04ubuntu4

---------------
kubuntu-notification-helper (15.04ubuntu4) vivid; urgency=medium

  * Fix infinite recursion and language lookup in hooks LP: #1434226
    + New class Locale to rip apart an input locale and build possible
      language value combinations from it. This is needed as some hooks use
      the encoding as part of the language identifier, which the previous code
      entirely disregarded.
    + Fix inifinte recursion when reading hook fields that broke in the qt5
      port as two functions differing by argument were folded into one causing
      infinite recursion when trying to read the actual values out of the map.
    + Defer the actual reading from the map to QMap#value which is really what
      should have been used all along (use case: read value, but fall back to
      default if key is not present).
    + Introduce a simple test case for hook reading checking invalidity and
      validity and actually reading fields along with 2 localized versions in
      the formats I have seen in use.
    + Introduce a test case for the new locale class ensuring that locale
      parsing is working as well as combination construction is correct and
      returns a list with correct order.
  * Import translations from launchpad.
  * Fix kcmshell4 -> kcmshell5 call.
 -- Harald Sitter <email address hidden> Wed, 01 Apr 2015 16:13:56 +0200

Changed in kubuntu-notification-helper (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Luke Johnstone (john-wella) wrote :

Happy to report that the fix is working on my system :) Thank you for the speedy fix :)

Revision history for this message
Georg Grabler (ggrabler) wrote :

Interesting, I didn't get the update on any of my machines. I decided to reinstall one of the machines, works great, did get notification-helper update.

The one I "updated" from beta1 didn't get it and still has the issue - using the main server, why does that one not get the update?

Ofc, another problem, but still interesting :D. Anyway, I forced the kded5 update copying the .deb from the fresh installed one to the updated one and installing it, and the issue was gone. Still strange why I didn't get the update (neither muon nor apt-get did tell there was an update available).

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.