Order by "Supported" Column Slow

Bug #165181 reported by clubsoda
116
This bug affects 15 people
Affects Status Importance Assigned to Milestone
synaptic (Debian)
New
Unknown
synaptic (Ubuntu)
Fix Released
Medium
Michael Vogt
Declined for Lucid by Sebastien Bacher
Declined for Maverick by Sebastien Bacher

Bug Description

Binary package hint: synaptic

At first I thought Synaptic was hanging on 100% CPU, but it turns out that the sort-by-supported (column #2) function performs very slowly when the number of packages is large. Up to 5,000 packages takes a few seconds but when all 23,000 packages are listed, ordering by this binary flag takes much much longer. [Four minutes on my Xubuntu machine.]

Version 0.60ubuntu5.

Revision history for this message
Koen (koen-beek) wrote :

I can confirm that sorting on this field takes a lot (much more than needed ?) of cpu and time

uname -a : Linux Dell_ubuntu 2.6.22-14-generic #1 SMP Sun Oct 14 21:45:15 GMT 2007 x86_64 GNU/Linux
synaptic 0.60ubuntu5

   Koen

Changed in synaptic:
status: New → Confirmed
Revision history for this message
Alan Jenkins (aj504) wrote :

Confirmed subjective impression that Synaptic hangs when performing this operation, after switching to Gutsy. Two different x86_64 computers, both with Universe + Multiverse repos.

Revision history for this message
Removed by request (removed1836289) wrote :

Confirmed, Ubuntu Hardy Heron beta amd64. Goes up to making synaptic crash.

Revision history for this message
Brian Croom (aikoniv) wrote :

This is still an issue in Intrepid.

Revision history for this message
LoonyPhoenix (loonyphoenix) wrote :

Still an issue in KARMIC. Come on, guys!

Revision history for this message
Lödur (loedur) wrote :

Hello,

if the list is sorted by "Supported" Column and I mark a package for installation it takes too a long time, until synaptic has noticed the change.

tested on:
Karmic 9.04 alpha 4
sysnaptic 0.62.7ubuntu2

Revision history for this message
YunQiang Su (wzssyqa) wrote :

in lucid amd64,it still exist.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

confirmed in bzr 1706

Changed in synaptic (Ubuntu):
importance: Undecided → Medium
status: Confirmed → Triaged
Revision history for this message
Michael Vogt (mvo) wrote :

The bottle-neck seems to sources->FindInIndex() in rpackage.cc line ~762.

Revision history for this message
Michael Vogt (mvo) wrote :

A fix could look something like this (this is just a prototype). This changes sort time to 1.5s (from 59,5s). Ideally we would do that in apt itself, having some more smartness there.

=== modified file 'common/rpackage.cc'
--- common/rpackage.cc 2010-01-25 10:17:45 +0000
+++ common/rpackage.cc 2010-02-17 10:30:48 +0000
@@ -744,6 +744,9 @@
 }

 #ifdef WITH_APT_AUTH
+std::map<pkgCache::PkgFileIterator, pkgIndexFile*> trust_cache;
+std::map<pkgCache::PkgFileIterator, pkgIndexFile*>::iterator it;
+
 bool RPackage::isTrusted()
 {
    pkgCache::VerIterator Ver;
@@ -757,17 +760,24 @@
    for (pkgCache::VerFileIterator i = Ver.FileList(); i.end() == false; i++)
    {
       pkgIndexFile *Index;
- if (Sources->FindIndex(i.File(),Index) == false)
- continue;
+ it = trust_cache.find(i.File());
+ if (it == trust_cache.end()) {
+ if (Sources->FindIndex(i.File(),Index) == false)
+ continue;
+ } else {
+ Index = (*it).second;
+ }
+ trust_cache.insert( pair<pkgCache::PkgFileIterator, pkgIndexFile*>(i.File
(), Index) );
+
       if (_config->FindB("Debug::pkgAcquire::Auth", false))
       {
          std::cerr << "Checking index: " << Index->Describe()
                    << "(Trusted=" << Index->IsTrusted() << ")\n";
       }
- if (Index->IsTrusted())
+ if (Index->IsTrusted()) {
          return true;
+ }
    }
-
    return false;
 }
 #else

Revision history for this message
Eric Appleman (erappleman) wrote :

Any update on this?

This is a huge Fitts Law problem for people like myself who like to sort by updates and will accidentally click on this column from time to time.

Changed in synaptic (Debian):
status: Unknown → New
Changed in synaptic (Ubuntu):
assignee: nobody → Jean-Baptiste Lallement (jibel)
status: Triaged → In Progress
Revision history for this message
Phil Hord (phil-phord) wrote :

Happens to me; also running x64. Is anyone seeing this in 32-bit mode?

More detail, though this should be easy enough for a developer to do as well.

strace shows that during this "hang" Synaptic is furiously fstatting the repository caches:

stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=8595099, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_restricted_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=29002, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_universe_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=26734222, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=8595099, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_restricted_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=29002, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_universe_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=26734222, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=8595099, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_restricted_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=29002, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_universe_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=26734222, ...}) = 0
stat("/var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_lucid_main_binary-amd64_Packages", {st_mode=S_IFREG|0644, st_size=8595099, ...}) = 0

Revision history for this message
Diaa Sami (diaa.sami) wrote :

I'd also like to add that after sorting, marking any package for installation takes a significantly long time(~25 seconds on my machine) with Synaptic not responding during that time.

I can report that as a separate bug if necessary but I think it's the same thing.

Revision history for this message
Diaa Sami (diaa.sami) wrote :

it happens on my Kubuntu 64-bit lucid.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

fix commited to bzr lp:~jibel/synaptic/bug.165181 revno 99

Changed in synaptic (Ubuntu):
status: In Progress → Fix Committed
Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

fix committed to bzr lp:~jibel/synaptic/bug.165181 revno 99

Revision history for this message
Eric Appleman (erappleman) wrote :

Can we get this merged into the archive?

It is so easy to misclick the "sort by supported" button.

Revision history for this message
busyb (busyb-wrkr) wrote :

Your hard work and diligence is always appreciated and I enjoy 99% of Ubuntu's in-built awesome-ness.

However... !WTF! I first noticed this bug on old P-4 crappy box with Ubuntu 7.0X
Now, on U10.04 LTS with AMDx4 32/64 bit (doesn't matter) nothing hangs for me, except this button.

Is this a VALID user interface button to prioritize SUPPORTED packages?
This is a duplicate of a duplicate bug. Please consider making the use of this "feature" functional for choosing supported applications and libraries over non-supported ones.

I do not care much for the irony of this bug at all. Image attached show what 3.2 Ghz X 4 will do when you choose to install anything supported (as in the photo the package "installation-report". =/

Revision history for this message
YunQiang Su (wzssyqa) wrote :

It seems that works well now, on 10.10.

Revision history for this message
Eric Appleman (erappleman) wrote :

Still broken for me. Brings Synaptic to a grinding halt.

Revision history for this message
Michael Vogt (mvo) wrote :

One problem with the attached patch is that it needs to be cleared if the cache is reopened. I work on a better one now.

Revision history for this message
Michael Vogt (mvo) wrote :

I uploaded a test package with a variant of the earlier patch to ppa:~mvo/synapic

https://edge.launchpad.net/~mvo/+archive/synaptic

Please give it a go and let me know if you notice any regressions or other odd behavior.

Revision history for this message
Eric Appleman (erappleman) wrote :

The algorithm is much faster now.

It's not instantaneous, but good enough.

Revision history for this message
YunQiang Su (wzssyqa) wrote :

It appears in natty again.

Revision history for this message
Jean-Baptiste Lallement (jibel) wrote :

@YunQiang Su, the fix is not in natty yet, you can test it from https://edge.launchpad.net/~mvo/+archive/synaptic

Changed in synaptic (Ubuntu):
assignee: Jean-Baptiste Lallement (jibel) → Michael Vogt (mvo)
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (3.9 KiB)

This bug was fixed in the package synaptic - 0.70~pre2ubuntu1

---------------
synaptic (0.70~pre2ubuntu1) natty; urgency=low

  * merged from debian/unstable, remaining changes:
    - ubuntu icons for supported applications
    - launchpad-integration
    - ubuntu changelog download support
    - support section metapackages
    - x-ubuntu-gettext-domain in desktop file

synaptic (0.70~pre2) unstable; urgency=low

  [ Michael Vogt ]
  * po/pt_BR.po:
    - updated, thanks to Sergio Cipolla (closes: #593758)
  * po/id.po:
    - added, thanks to Dirgita
  * po/ru.po:
    - updated, thansk to Yuri Kozlov (closes: #571712)
  * po/de.po:
    - fix fuzzy string, thanks to Alek (closes: #599744)
  * po/et.po:
    - updated, thanks to Guido Tabbernuk
  * po/he.po:
    - updated, thanks to Lior Kaplan and Sergio Cipolla
      (closes: #586940)
  * gtk/rgdebinstallprogress.cc, gtk/rgterminstallprogress.cc:
    - fix FTBFS on latest vte (closes: #597384)
  * common/rpackagecache.{cc,h}, common/rpackage.cc:
    - add cache for PkgFileIterator->pkgIndexFile* to speed up
      RPackage::IsTrusted (LP: #165181)
  * gtk/rgdebinstallprogress.cc:
    - merge fix for error string if those contain a ":"
      (LP: #600658), thanks to Jonathan Thomas and Jean-Baptiste Lallement
  * common/rpackagelister.cc:
    - when sorting by support status use STL stable_parition to speed
      up the list view (thanks to David Purcell)
    - when clicking on the "supported" column, default to showing the
      supported items first, then the unsupported ones
  * gtk/rgmainwindow.cc:
    - show message in quick search label if no apt-xapian-index can
      be found

   [ Jean-Baptiste Lallement ]
   * gtk/rgdebinstallprogress.{cc,h}: Terminal shortcuts fixes
     - fix <CTRL><SHIFT>c behavior (LP: #250359)
     - add shortcuts <CTRL>a and <CTRL><SHIFT>a to select all/none text
       in the terminal
     - add contextual menu to the terminal to select all and copy text
       (LP: #31396)

synaptic (0.70~pre1) unstable; urgency=low

  * New upstream release that merges all changes from
    Debian and Ubuntu into a single tree again. This include libept
    support and lots of fixes.
  * po/sl.po:
    - updated, thanks to Matej Urbančič
  * po/pt_BR.po:
    - updatd, thanks to Sergio Cipolla, closes: #579296
  * gtk/rgmainwindow.cc:
    - fix hang when applying the preferences (LP: #172487)
  * po/th.po:
    - updated, thanks to Theppitak Karoonboonyanan
      (closes: #592696)
  * pre-build.sh:
    - ensure version number gets updated on build

synaptic (0.63.2) unstable; urgency=low

  [ Michael Vogt ]
  * po/uk.po:
    - updated, thanks to Serhij Dubyk
  * po/it.po:
    - updated, thanks to Milo Casagrande (closes: #575685)
  * po/et.po:
    - added, thanks to G. Tabbernuk

  [ Bilal Akhtar ]
  * gtk/rgmainwindow.cc
    - Modify gtk/rgmainwindow.cc to populate package list again after
     'Unmark All' is selected. (LP: #155930)

  [ Jean-Baptiste Lallement ]
  * Fix sorting issues of the package list
    - Fix sort by name and by section (LP: #518509)
    - Improve sort by column performance
  * sort 'installed files' list in alphabetical order (LP: #32550)
  * Set versi...

Read more...

Changed in synaptic (Ubuntu):
status: Fix Committed → Fix Released
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.