Skip to content

Listing Compute Usages Returns Incomplete Response #25455

Open

Description

  • Package Name: azure-mgmt-compute
  • Package Version: 30.0.0
  • Operating System: Linux
  • Python Version: 3.9.16

Describe the bug
Calling .usage.list() on a ComputeManagementClient in the Python SDK will inconsistently result in a DecodeError. This method call will result in calls to the Compute Usage List API. We see this happening in less than 10% of calls for affected subscriptions.

Originally opened against azure-sdk-for-python in #issue-31643

Sample tail of stack trace:

  File "/usr/local/lib/python3.9/site-packages/azure/core/paging.py", line 124, in __next__
    return next(self._page_iterator)
  File "/usr/local/lib/python3.9/site-packages/azure/core/paging.py", line 76, in __next__
    self._response = self._get_next(self.continuation_token)
  File "/usr/local/lib/python3.9/site-packages/azure/mgmt/compute/v2019_03_01/operations/_operations.py", line 8929, in get_next
    pipeline_response: PipelineResponse = self._client._pipeline.run(  # pylint: disable=protected-access
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 202, in run
    return first_node.send(pipeline_request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 70, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 70, in send
    response = self.next.send(request)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 70, in send
    response = self.next.send(request)
  [Previous line repeated 1 more time]
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_base.py", line 75, in send
    _await_result(self._policy.on_response, request, response)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/_tools.py", line 35, in await_result
    result = func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/policies/_universal.py", line 712, in on_response
    response.context[self.CONTEXT_NAME] = self.deserialize_from_http_generics(
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/policies/_universal.py", line 677, in deserialize_from_http_generics
    return cls.deserialize_from_text(response.text(encoding), mime_type, response=response)
  File "/usr/local/lib/python3.9/site-packages/azure/core/pipeline/policies/_universal.py", line 609, in deserialize_from_text
    raise DecodeError(
azure.core.exceptions.DecodeError: JSON is invalid: Expecting property name enclosed in double quotes: line 679 column 21 (char 15692)
Content: {
  "value": [
    {
      "limit": 2500,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "availabilitySets",
        "localizedValue": "Availability Sets"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "cores",
        "localizedValue": "Total Regional vCPUs"
      }
    },
    {
      "limit": 25000,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "virtualMachines",
        "localizedValue": "Virtual Machines"
      }
    },
    {
      "limit": 2500,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "virtualMachineScaleSets",
        "localizedValue": "Virtual Machine Scale Sets"
      }
    },
    {
      "limit": 3000,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "dedicatedVCpus",
        "localizedValue": "Dedicated vCPUs"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "lowPriorityCores",
        "localizedValue": "Total Regional Low-priority vCPUs"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "basicAFamily",
        "localizedValue": "Basic A Family vCPUs"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "standardA0_A7Family",
        "localizedValue": "Standard A0-A7 Family vCPUs"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {
        "value": "standardA8_A11Family",
        "localizedValue": "Standard A8-A11 Family vCPUs"
      }
    },
    {
      "limit": 350,
      "unit": "Count",
      "currentValue": 0,
      "name": {

To Reproduce
We have been unable to reliably reproduce the issue. However we do continually see a handful of these errors each hour in our logs. Attempts at cataloging the response from the API have confirmed the API does indeed cut off the response as seen in the example above.

Expected behavior
The response from azure side should be properly decoded instead of a JSON error. This would appear to require the underlying API to return a complete response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

ComputeService AttentionWorkflow: This issue is responsible by Azure service team.customer-reportedIssues that are reported by GitHub users external to the Azure organization.needs-team-attentionWorkflow: This issue needs attention from Azure service team or SDK teamquestionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions