software-center crashed with OSError in makedirs(): [Errno 17] File exists: '/home/joris/.cache/software-center'

Bug #743003 reported by Georgie on 2011-03-26
140
This bug affects 18 people
Affects Status Importance Assigned to Milestone
software-center (Ubuntu)
Medium
RONALD CONCEPCION
Precise
Undecided
Unassigned
Quantal
Medium
Gary Lasker

Bug Description

Binary package hint: software-center

Happens during startup Software Center on my brand new Dell XPS laptop.

TEST CASE:

This bug is the result of a race condition between two different processes that is not possible to induce directly. To verify this bug, simply start Ubuntu Software Center a number of times and verify that the attached stack trace never occurs and that Ubuntu Software Center starts normally.

ProblemType: Crash
DistroRelease: Ubuntu 11.04
Package: software-center 3.1.24.2
ProcVersionSignature: Ubuntu 2.6.38-7.38-generic-pae 2.6.38
Uname: Linux 2.6.38-7-generic-pae i686
Architecture: i386
Date: Sat Mar 26 10:06:14 2011
ExecutablePath: /usr/share/software-center/software-center
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110325)
InterpreterPath: /usr/bin/python2.7
ProcCmdline: /usr/bin/python /usr/bin/software-center btnx-config/btnx
ProcEnviron:
 SHELL=/bin/bash
 LANGUAGE=en_US:en
 LANG=en_US.UTF-8
PythonArgs: ['/usr/bin/software-center', 'btnx-config/btnx']
SourcePackage: software-center
Title: software-center crashed with OSError in makedirs(): [Errno 17] File exists: '/home/joris/.cache/software-center'
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare

Related branches

Georgie (jdecoo) wrote :
tags: removed: need-duplicate-check
Kiwinote (kiwinote) on 2011-03-28
visibility: private → public
Changed in software-center (Ubuntu):
status: New → Confirmed
Michael Vogt (mvo) wrote :

Shows up with high frequency on errors.ubuntu.com, caused by a race:

=== modified file 'softwarecenter/log.py'
--- softwarecenter/log.py 2012-03-15 10:43:13 +0000
+++ softwarecenter/log.py 2012-05-08 18:55:17 +0000
@@ -93,7 +93,13 @@

 # create log file
 if not os.path.exists(SOFTWARE_CENTER_CACHE_DIR):
- os.makedirs(SOFTWARE_CENTER_CACHE_DIR)
+ try:
+ os.makedirs(SOFTWARE_CENTER_CACHE_DIR)
+ except OSError as e:
+ if e.errno == 17:
+ pass
+ else:
+ raise
 logfile_path = os.path.join(SOFTWARE_CENTER_CACHE_DIR, "software-center.log")

 # try to fix inaccessible s-c directory (#688682)

Changed in software-center (Ubuntu):
importance: Undecided → Medium
milestone: none → precise-updates
tags: added: ca-escalated
Michael Vogt (mvo) wrote :

Instead of e.errno == 17 we probably want to use something like "import errno; errno.EEXIST".

But the code looks wrong currently, it first tries to create the dir, then odes a os.access and tries to redo it again,
so this needs cleanup and a unittest.

Gary Lasker (gary-lasker) wrote :

This is currently the highest software-center bug on errors.ubuntu.com, so setting the importance and tagging it as ca-escalated.

Changed in software-center (Ubuntu):
assignee: nobody → Gary Lasker (gary-lasker)
Gary Lasker (gary-lasker) wrote :

Ah shoot, talk about a race!! ;) I should have refreshed before I started working on this, I guess. I think I have a general fix that can be used for all instances of this condition (there are a few I have searched out, so I'll push by branch and see what you think).

Gary Lasker (gary-lasker) wrote :

Regarding the branch I attached, we can check the "errno" value directly if preferred, per your comments above, mvo. The specific check for the directory just seemed slightly more readable, but I'm sure it's slower (not that speed matters for this case).

If this fix seems ok, I'll wire it in for related bug 836172, bug 936917, bug 973293 and bug 975156.

Changed in software-center (Ubuntu):
status: Confirmed → In Progress
Changed in software-center (Ubuntu):
status: In Progress → Fix Committed

Hello Georgie, or anyone else affected,

Accepted software-center into precise-proposed. The package will build now and be available in a few hours. Please test and give feedback here. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

tags: added: verification-needed
Steve Langasek (vorlon) on 2012-05-16
Changed in software-center (Ubuntu Precise):
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :
Download full text (3.4 KiB)

This bug was fixed in the package software-center - 5.2.2

---------------
software-center (5.2.2) precise-proposed; urgency=low

  [ Michael Vogt ]
  * lp:~mvo/software-center/whatsnew-leak-lp985389:
    - search filter fix for the case when the "installed-only"
      filter leaks into subsequent searches (LP: #985389)
  * lp:~mvo/software-center/fix-lp994632:
    - add a dep to ensure we get the correct ubuntu-sso-client-gtk
      (LP: #994632)
  * lp:~mvo/software-center/proper-error-on-unknown-files:
    - show a proper error message when attempting to open unknown
      file types (LP: #944868)
  * lp:~mvo/software-center/lp921799:
    - fix crash when decoding screenshots JSON (LP: #921799)
  * lp:~mvo/software-center/lp959612:
    - fix crash when selecting the Installed view very quickly
      after startup (LP: #959612)

  [ Ken VanDine ]
  * lp:~ken-vandine/software-center/lp_982567:
    - Check if the proxy is enabled, if the proxy host is set but not
      enabled we shouldn't attempt to use the proxy (LP: #982567)

  [ Gary Lasker ]
  * lp:~gary-lasker/software-center/fix-crash-lp969732:
    - need to explicitly declare the needs-refresh signal in the
      AppTreeStore class to prevent a crash (LP: #969732)
  * lp:~gary-lasker/software-center/fix-crash-lp870822:
    - don't crash if we don't get a pkgversion object back
      (LP: #870822)
  * lp:~gary-lasker/software-center/fix-shutdown-crash-lp996333:
    - never crash when writing out the software center config file on
      shutdown (LP: #996333)
  * lp:~gary-lasker/software-center/fix-makedirs-race-crashes:
    - fix crash on race when creating the cache or config directories
      (LP: #743003, LP: #621182)
  * lp:~gary-lasker/software-center/fix-crash_lp973379:
    - ensure that the cache is ready before using the recommender
      service (LP: #973379 )
  * lp:~gary-lasker/software-center/toolbar-buttons-insensitive-during-startup:
    - set the toolbar buttons insensitive for the duration of time that the
      lobby panels are initializing (LP: #999486, LP: #994341)

  [ Robert Roth ]
  * lp:~evfool/software-center/bug532072:
    - escape markup for support info and license (LP: #993279)
    - ellipsize summary at trailing end (LP: #532072)
  * lp:~evfool/software-center/lp626037:
    - subtle background color tweak for consistency
      between views (LP: #626037)
  * lp:~evfool/software-center/lp835005:
    - no need for the software-properties dialog to be modal
      to software-center (LP: #835005)
  * lp:~evfool/software-center/lp839389:
    - don't display an "icon not found" image in the Unity
      launcher when a report a review window is opened (LP: #839389)
  * lp:~evfool/software-center/867588:
    - capitalize the first letter of the package summary
      (LP: #867588)
  * lp:~evfool/software-center/lp876657:
    - make sure the search field does not disappear when an
      install or remove is in progress (LP: #876657)
  * lp:~evfool/software-center/lp987797:
    - fix alignment in the reviews part of the appdetails (LP: #987797)
  * lp:~evfool/software-center/lp844768:
    - show a indeterminate progress bar when software-center waits for
      another ...

Read more...

Changed in software-center (Ubuntu Quantal):
status: Fix Committed → Fix Released
Gary Lasker (gary-lasker) wrote :

I have verified that software-center version 5.2.2 in precise-proposed fixes this bug per the test case given in the description.

Thanks!

description: updated
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :
Download full text (3.4 KiB)

This bug was fixed in the package software-center - 5.2.2

---------------
software-center (5.2.2) precise-proposed; urgency=low

  [ Michael Vogt ]
  * lp:~mvo/software-center/whatsnew-leak-lp985389:
    - search filter fix for the case when the "installed-only"
      filter leaks into subsequent searches (LP: #985389)
  * lp:~mvo/software-center/fix-lp994632:
    - add a dep to ensure we get the correct ubuntu-sso-client-gtk
      (LP: #994632)
  * lp:~mvo/software-center/proper-error-on-unknown-files:
    - show a proper error message when attempting to open unknown
      file types (LP: #944868)
  * lp:~mvo/software-center/lp921799:
    - fix crash when decoding screenshots JSON (LP: #921799)
  * lp:~mvo/software-center/lp959612:
    - fix crash when selecting the Installed view very quickly
      after startup (LP: #959612)

  [ Ken VanDine ]
  * lp:~ken-vandine/software-center/lp_982567:
    - Check if the proxy is enabled, if the proxy host is set but not
      enabled we shouldn't attempt to use the proxy (LP: #982567)

  [ Gary Lasker ]
  * lp:~gary-lasker/software-center/fix-crash-lp969732:
    - need to explicitly declare the needs-refresh signal in the
      AppTreeStore class to prevent a crash (LP: #969732)
  * lp:~gary-lasker/software-center/fix-crash-lp870822:
    - don't crash if we don't get a pkgversion object back
      (LP: #870822)
  * lp:~gary-lasker/software-center/fix-shutdown-crash-lp996333:
    - never crash when writing out the software center config file on
      shutdown (LP: #996333)
  * lp:~gary-lasker/software-center/fix-makedirs-race-crashes:
    - fix crash on race when creating the cache or config directories
      (LP: #743003, LP: #621182)
  * lp:~gary-lasker/software-center/fix-crash_lp973379:
    - ensure that the cache is ready before using the recommender
      service (LP: #973379 )
  * lp:~gary-lasker/software-center/toolbar-buttons-insensitive-during-startup:
    - set the toolbar buttons insensitive for the duration of time that the
      lobby panels are initializing (LP: #999486, LP: #994341)

  [ Robert Roth ]
  * lp:~evfool/software-center/bug532072:
    - escape markup for support info and license (LP: #993279)
    - ellipsize summary at trailing end (LP: #532072)
  * lp:~evfool/software-center/lp626037:
    - subtle background color tweak for consistency
      between views (LP: #626037)
  * lp:~evfool/software-center/lp835005:
    - no need for the software-properties dialog to be modal
      to software-center (LP: #835005)
  * lp:~evfool/software-center/lp839389:
    - don't display an "icon not found" image in the Unity
      launcher when a report a review window is opened (LP: #839389)
  * lp:~evfool/software-center/867588:
    - capitalize the first letter of the package summary
      (LP: #867588)
  * lp:~evfool/software-center/lp876657:
    - make sure the search field does not disappear when an
      install or remove is in progress (LP: #876657)
  * lp:~evfool/software-center/lp987797:
    - fix alignment in the reviews part of the appdetails (LP: #987797)
  * lp:~evfool/software-center/lp844768:
    - show a indeterminate progress bar when software-center waits for
      another ...

Read more...

Changed in software-center (Ubuntu Precise):
status: Fix Committed → Fix Released
Changed in software-center (Ubuntu):
assignee: tremolux (gary-lasker) → RONALD CONCEPCION (ronaldconcepcion2000)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers