[2.2, 2.3] RegionService can raise unexpected exceptions for an empty connection list

Bug #1705254 reported by Mike Pontillo
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
High
Mike Pontillo
2.2
Fix Released
High
Mike Pontillo

Bug Description

The symptom can be seen as follows:

2017-07-18 18:11:46 maasserver.utils.views: [error] 500 Internal Server Error @ /MAAS/rpc/
Traceback (most recent call last):
  File "/usr/lib/python3.5/random.py", line 253, in choice
    i = self._randbelow(len(seq))
  File "/usr/lib/python3.5/random.py", line 230, in _randbelow
    r = getrandbits(k) # 0 <= r < 2**k
ValueError: number of bits must be greater than zero

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/django/core/handlers/base.py", line 108, in get_response
    response = middleware_method(request)
  File "/usr/lib/python3/dist-packages/maasserver/middleware.py", line 160, in process_request
    self._check_rack_controller_connectivity()
  File "/usr/lib/python3/dist-packages/maasserver/middleware.py", line 133, in _check_rack_controller_connectivity
    connected_ids = list(client.ident for client in getAllClients())
  File "/usr/lib/python3/dist-packages/provisioningserver/utils/twisted.py", line 169, in wrapper
    return func_in_reactor(*args, **kwargs).wait(LONGTIME)
  File "/usr/lib/python3/dist-packages/crochet/_eventloop.py", line 231, in wait
    result.raiseException()
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 368, in raiseException
    raise self.value.with_traceback(self.tb)
IndexError: Cannot choose from an empty sequence

Related branches

Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
milestone: 2.3.0 → 2.3.0alpha1
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.