aptdaemon consumes more than 2-3 MByte of system memory

Bug #492973 reported by Ev Kontsevoy
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Aptdaemon
Invalid
Undecided
Unassigned
aptdaemon (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

aptd daemon uses about 10x more RAM than it should: 13MB!!!

This daemon performs a tiny peripheral task yet it is the 3rd most RAM hungry process on a fresh Ubuntu installation, behind only XOrg and Compiz.

This is inexplicable to implement such marginal services in VM-based languages and ship them as part of a core OS distribution. Ubuntu runs about 100 processes by default and if each of them needed 13MB just to sit and do nothing we would have needed 1.3GB just to boot.

Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

OS core daemons is systems programming, not a django app.

Proposed fix: rewrite /usr/lib/python2.6/dist-packages/aptdaemon in C

Revision history for this message
Sebastian Heinlein (glatzor) wrote :

1. aptdaemon is D-Bus activated - it only gets started on request
2. aptdaemon has got an idle time and will shutdown after some minutes of idling
3. aptdaemon does only require 26 MByte on my system
4. I am investigating threading instead of forking for the installation

Furthermore this is a bug reporting system and not a ranting forum.

There seem to be a memory leak in aptdaemon (most likely in the underlying python-apt). If you are willing to solve this bug you can write which action you performed. What is the memory consumption of aptdaemon when started from the console: sudo /usr/sbin/aptd -td

Revision history for this message
Sebastian Heinlein (glatzor) wrote :

python-apt 0.8 will bring some further memory handling optimaziations.

Changed in aptdaemon:
status: New → Incomplete
Changed in aptdaemon:
status: Incomplete → New
Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

"Only requires 26MB"? That's 5 times of Apache Web Server!

Look, it does not matter how much RAM computers have these days: if you are writing a small peripheral daemon, you've got 0.5-2MB to fit it in. You simply cannot do it in Python.

I will repeate one more time: if every single one of daemons Ubuntu runs is written in Python, the operating system would require 1.5GB of RAM just to boot.

This is a bug, Sebastian, and a very serious one. I am not ranting, I am trying to fix what's broken. Perhaps I am opening bugs for the wrong person, can you please tell me who made the decision to include aptd in Ubuntu? Maybe I should be talking to that person.

Can you fit your daemon into 2-3MB just like *every other daemon* on the system? If not, remove it from the core distribution until it's fixed. This is irresponsible: if other Ubuntu developers start grabbing megabytes of RAM for their individual goals, the entire project will drawn in irrelevance.

Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

To answer your question: when I run it from the console, it immediately consumes 13.1MB, you've got 10MB to shave off somehow.

Changed in aptdaemon:
status: New → Invalid
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

Sorry, but I declare this bug as invalid. 2-3 Mbyte memory consumption is not a realisitc development goal of aptdaemon.

The apt package cache is already quite large - in every language. Please take a look at how much memory is consumed by Synaptic or the apt-get tool.

Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

Sebastian, apt-get and Synaptic are not daemons.

Daemons are not permitted to consume 13MB of RAM unless they are SQL servers, Web Servers or something equally large.

My parents are using an older PC with Ubuntu on it, just like many other folks.

With Gnome and a few pages in Firefox open, they have about 100MB of free RAM, and your huge, fat little daemon consumes 13% of it.

This is bug, a big nasty bug. Daemons aren't permitted to use that much RAM. No other daemon in a clean Ubuntu install consumes more than 5.

Changed in aptdaemon:
status: Invalid → New
Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

A thought: why is this a daemon? Can't you just shut it down immediately after you handle d-bus event?
Please understand: I want this issue resolved and I am offering my help if you need any.
Thank you.

Revision history for this message
Sebastian Heinlein (glatzor) wrote :

As I already told you: It is not a development goal to get 2-3 Mbyte of memory usage. Because this cannot be reached.

You declare a rule without any rationale.

Please read my first answer to this bug again - this is #2.

AptDaemon is not an always running daemon. It is a programme that provides a package management backend over D-Bus. If it isn't used any more it goes away.

Currently you just stop me from coding since I have to declare this bug invalid again.

summary: - aptd daemon is using too much RAM
+ aptdaemon consumes more than 2-3 MByte of system memory
Changed in aptdaemon:
status: New → Invalid
Revision history for this message
Sebastian Heinlein (glatzor) wrote :

If the idle time is too long or doesn't work please open a new bug report.

If it consumes more than 30 MByte on your system please open a new bug report.

Revision history for this message
Ev Kontsevoy (biz-kontsevoy) wrote :

Apologies, I missed the fact that it goes away, ughh... my bad.

Anyway I have two machines and one of them seems to have aptd "stuck" while the other works as advertised - it goes away. I will try to figure out the difference between the two and will open a new bug when I have more data.

Thanks.

affects: ubuntu → aptdaemon (Ubuntu)
Changed in aptdaemon (Ubuntu):
status: New → Invalid
Revision history for this message
Dorian (ikolpm) wrote :

I also think it could be a very very good idea to rewrite it in C.

This is an important part of the consumption, and if i was written in C, the system memory require would easily be less than 3MB (It's a fact, look at studies over the Internet).

Revision history for this message
Sebastian Heinlein (glatzor) wrote : Re: [Bug 492973] Re: aptdaemon consumes more than 2-3 MByte of system memory

Hello. The biggest part of the consumed memory is used by the apt cache. So take a look at the memory usage of other package managers before making ans blind assumptions. If you want to rewrite aptdaemon feel free to contact me.
--
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

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

Other bug subscribers

Related questions

Remote bug watches

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