In 3.5.0 image sync download-bootresourcefile activity fails with "integer division or modulo by zero"

Bug #2058037 reported by Jacopo Rota
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Committed
High
Jacopo Rota
3.5
Fix Committed
High
Jacopo Rota

Bug Description

In 3.5.0 in an environment with 3 nodes in HA some "download-bootresourcefile" are always failing with

{
  "message": "integer division or modulo by zero",
  "stackTrace": " File \"/snap/maas/34137/usr/lib/python3/dist-packages/temporalio/worker/_activity.py\", line 439, in _run_activity\n result = await impl.execute_activity(input)\n\n File \"/snap/maas/34137/usr/lib/python3/dist-packages/temporalio/worker/_activity.py\", line 694, in execute_activity\n return await input.fn(*input.args)\n\n File \"/snap/maas/34137/lib/python3.10/site-packages/maasserver/workflow/bootresource.py\", line 123, in download_bootresourcefile\n activity.info().attempt % len(param.source_list)\n",
  "applicationFailureInfo": {
    "type": "ZeroDivisionError"
  }
}

see the screenshot attached.

This happens because the parameter of the bootresource-download activity is

[
  {
    "extract_paths": [],
    "force": false,
    "rfile_ids": [
      22
    ],
    "sha256": "189757828954b839863e877fada48e58a9f4d86ac4ff601ab84cceb8896a12b1",
    "size": 0,
    "source_list": [],
    "total_size": 133248031
  }
]

and source_list is empty

Related branches

Revision history for this message
Jacopo Rota (r00ta) wrote :
Jacopo Rota (r00ta)
description: updated
Revision history for this message
Jacopo Rota (r00ta) wrote :

Found out that

    @activity.defn(name="get-bootresourcefile-endpoints")
    async def get_bootresourcefile_endpoints(self) -> dict[str, list]:
        url = f"{self.url}/api/2.0/regioncontrollers/"
        regions = await self.request_async("GET", url)
        return {
            r["system_id"]: [
                compose_URL("http://:5240/MAAS/boot-resources/", src)
                for src in r["ip_addresses"]
            ]
            for r in regions
        }

might actually return empty list for some regions

[
  {
    "dnsatk": [],
    "m4mmw8": [
      "http://10.244.40.32:5240/MAAS/boot-resources/",
      "http://192.168.33.23:5240/MAAS/boot-resources/"
    ],
    "mthcpn": [
      "http://10.244.40.31:5240/MAAS/boot-resources/",
      "http://10.244.40.33:5240/MAAS/boot-resources/",
      "http://192.168.33.22:5240/MAAS/boot-resources/"
    ]
  }
]

Jacopo Rota (r00ta)
Changed in maas:
assignee: nobody → Jacopo Rota (r00ta)
Changed in maas:
status: Triaged → Fix Committed
Changed in maas:
milestone: 3.5.0 → 3.6.0
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.