desktopcouch Value error cannot covert float Nan to integer

Bug #886159 reported by fishears
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
desktopcouch (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

When I run this:
jb@jb-K7S41:~$ /usr/lib/desktopcouch/desktopcouch-service

I get the following output:
Traceback (most recent call last):
  File "/usr/lib/desktopcouch/desktopcouch-service", line 41, in <module>
    from desktopcouch.service import DesktopcouchService
  File "/usr/lib/pymodules/python2.7/desktopcouch/service.py", line 9, in <module>
    from desktopcouch.application.service import *
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/service.py", line 44, in <module>
    from desktopcouch.application import local_files
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/local_files.py", line 297, in <module>
    keyring=Keyring())
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/local_files.py", line 226, in __init__
    self.configuration = _Configuration(self)
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/local_files.py", line 128, in __init__
    ctx.keyring.get_oauth_data()
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/platform/linux/keyring.py", line 68, in get_oauth_data
    consumer_key = self.make_random_string(10)
  File "/usr/lib/pymodules/python2.7/desktopcouch/application/util.py", line 26, in make_random_string
    return ''.join([entropy.choice(string.letters) for _ in range(count)])
  File "/usr/lib/python2.7/random.py", line 274, in choice
    return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty
ValueError: cannot convert float NaN to integer

This last line is the same error I get in red on the Services tab of the UbuntuOne Control Panel.
(fresh install)

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: desktopcouch 1.0.8-0ubuntu1
ProcVersionSignature: Ubuntu 3.0.0-13.22-generic 3.0.6
Uname: Linux 3.0.0-13-generic i686
NonfreeKernelModules: nvidia
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Fri Nov 4 14:49:25 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
PackageArchitecture: all
SourcePackage: desktopcouch
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
fishears (johnnyp-ntlworld) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

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

Changed in desktopcouch (Ubuntu):
status: New → Confirmed
Revision history for this message
vtec (vitekcvachoucek) wrote :

I have made an intensive investigation into this one. I am java developer not a python guy but still I think you would consider my findings interesting:

Looks like it is a problem with the state of python bullt-in time module at the moment of the failure.

The problem stems from fact that the very first invocation of time.time() invocation yields NaN. I have tried to investigate the time method and time module but both dir() and help() would work just fine and produce believable results. Then I noted the traceback of the failure is not a full length so I added explicit traceback.print_stack() call nearby - AND THE DAMMED THING JUST STARTED TO WORK!!!!!!!!!!!!!!!!!

The traceback.print_stack() must internally manipulate the python modules loaded and make some change to it. There are some interesting constructs on the stack - e.g. yield based iterator or some native code - might this have something with the problem? I have run into similar problem

This is the modified /usr/share/pyshared/desktopcouch/application/local_files.py save_to_file method starting at line 157

    def save_to_file(self, file_name):
        """Save to file."""
        container = os.path.split(file_name)[0]
        import traceback, sys, time
        sys.stderr.write(
        """ ----------------------------------
                           Traceback
        ---------------------------------- """)
        traceback.print_stack()
        sys.stderr.write("""
                             Time %s
        --------------------------------------- """ % time.time)
        fd, temp_file_name = tempfile.mkstemp(dir=container)
        f = os.fdopen(fd, "w")
        try:
            self._c.write(f)
        finally:
            f.close()
        os.rename(temp_file_name, file_name)

Is there some linux & python guy willing to help me to investigate it further and come to reasonable conclusion?

Revision history for this message
Gregory P Smith (gpshead) wrote :

FYI - I've filed http://bugs.python.org/issue14028 to track this as well from the Python side.

Revision history for this message
Gregory P Smith (gpshead) wrote :

As noted in the python issue, the problem in my case turned out to be bad hardware. I suspect the same of the initial reporter of this bug.

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.