[tahoe-lafs-trac-stream] [tahoe-lafs] #1516: don't catch and ignore EnvironmentError when trying to get disk stats

tahoe-lafs trac at tahoe-lafs.org
Thu Dec 13 17:23:20 UTC 2012


#1516: don't catch and ignore EnvironmentError when trying to get disk stats
------------------------------+------------------------
     Reporter:  zooko         |      Owner:  davidsarah
         Type:  defect        |     Status:  assigned
     Priority:  minor         |  Milestone:  1.11.0
    Component:  code-storage  |    Version:  1.9.0a1
   Resolution:                |   Keywords:  error
Launchpad Bug:                |
------------------------------+------------------------
Changes (by davidsarah):

 * milestone:  1.10.0 => 1.11.0


Old description:

> I would rather see things fail than report "available space == 0".
>
> {{{
> HACK zompu:~/playground/tahoe-lafs/what-393-called-trunk$ darcs diff -u
> src/allmydata/util/fileutil.py
> --- old-what-393-called-trunk/src/allmydata/util/fileutil.py
> 2011-08-29 12:06:41.597004643 -0600
> +++ new-what-393-called-trunk/src/allmydata/util/fileutil.py
> 2011-08-29 12:06:41.612004695 -0600
> @@ -415,6 +415,3 @@
>          return get_disk_stats(whichdir, reserved_space)['avail']
>      except AttributeError:
>          return None
> -    except EnvironmentError:
> -        log.msg("OS call to get disk statistics failed")
> -        return 0
> }}}
>
> I did encounter a case where this catch-and-return-0 was hiding the
> existence of a bug. It wasn't a bug in trunk, it was a bug in my working
> version, but still.

New description:

 I would rather see things fail than report "available space == 0".

 {{{
 HACK zompu:~/playground/tahoe-lafs/what-393-called-trunk$ darcs diff -u
 src/allmydata/util/fileutil.py
 --- old-what-393-called-trunk/src/allmydata/util/fileutil.py    2011-08-29
 12:06:41.597004643 -0600
 +++ new-what-393-called-trunk/src/allmydata/util/fileutil.py    2011-08-29
 12:06:41.612004695 -0600
 @@ -415,6 +415,3 @@
          return get_disk_stats(whichdir, reserved_space)['avail']
      except AttributeError:
          return None
 -    except EnvironmentError:
 -        log.msg("OS call to get disk statistics failed")
 -        return 0
 }}}

 I did encounter a case where this catch-and-return-0 was hiding the
 existence of a bug. It wasn't a bug in trunk, it was a bug in my working
 version, but still.

--

-- 
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1516#comment:3>
tahoe-lafs <https://tahoe-lafs.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list