Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-630

Divide by zero error during CD lookup

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.3
    • Component/s: Lookup & Match
    • Labels:
      None
    • Environment:
      Linux 3.14.6-1-ARCH #1 SMP PREEMPT Sun Jun 8 10:08:38 CEST 2014 x86_64 GNU/Linux
      Python 2.7.7

      Description

      Periodically the when doing "Lookup" on a cluster during the phase where the found release is returned, a divide by zero error occurs. The entry shows on the screen as *[loading Album Information]*.

      Stack trace:

      Traceback (most recent call last):
        File "/usr/lib/python2.7/site-packages/picard/webservice.py", line 285, in _process_reply
          handler(document, reply, error)
        File "/usr/lib/python2.7/site-packages/picard/album.py", line 174, in _release_request_finished
          self._finalize_loading(error)
        File "/usr/lib/python2.7/site-packages/picard/album.py", line 279, in _finalize_loading
          self.match_files(self.unmatched_files.files)
        File "/usr/lib/python2.7/site-packages/picard/album.py", line 368, in match_files
          sim = track.metadata.compare(file.orig_metadata)
        File "/usr/lib/python2.7/site-packages/picard/metadata.py", line 93, in compare
          return linear_combination_of_weights(parts)
        File "/usr/lib/python2.7/site-packages/picard/util/__init__.py", line 339, in linear_combination_of_weights
          return sum_of_products / total
      ZeroDivisionError: float division by zero
      

      Resolution:

      Change line 339 in picard/util/_init_.py from

          return sum_of_products / total
      

      to

          return 0 if total == 0 else sum_of_products / total
      

      Also commented on the GitHub commit

      I will revert my change and capture full debug output. When the problem occurs again I'll add the detail to the ticket .

        Attachments

          Activity

            People

            • Assignee:
              zas Zas
              Reporter:
              starfry John Lane
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: