Skip to content

Fix 'NoneType' object has no attribute when querying during Session not available retry - #37578

Merged
bambriz merged 5 commits into
Azure:mainfrom
bambriz:users-bambriz-nonetype-request
Oct 2, 2024
Merged

bambriz merged 5 commits into
Azure:mainfrom
bambriz:users-bambriz-nonetype-request

Conversation

@bambriz

@bambriz bambriz commented Sep 25, 2024 •

Copy link
Copy Markdown
Member

Description

When Session Retry, Timeout Failover, and Endpoint Discovery retry policies are triggered and do no successfully retry during a Query, a bug occurs that raises a 'NoneType' object has no attribute from a request object. This was caused from the request to fetch the queried items returning back to the base request to start the query. Instead of returning the Cosmos Exception from not successfully retrying, the retry would happen again for the base query request, but the base query request does not have a reference to the Request Object (This is where the 'NoneType' object has no attribute error comes from). This is fixed by allowing the cosmos exception to surface by not retrying at the base request since we already used up the retry attempts while fetching the items during the query.

    graph TD
    A[Execute Base Query Request] --> B[Fetch Items Per Page]
    B --> C[Request Per Page of Queried Items]
    C -->|Retry Fails| D[Exception]
    D --> E[Return to Base Execution]
    E -->|Check Retry| F[Nonetype Exception]


Loading
    graph TD
    A[Execute Base Query Request] --> B[Fetch Items Per Page]
    B --> C[Request Per Page of Queried Items]
    C -->|Retry Fails| D[Cosmos Exception]
    D --> E[Exception Surfaces to User]

Loading

Fixes 'NoneType' object has no attribute when session retry is triggered and does not succesfully retry while querying.
@bambriz

bambriz commented Sep 25, 2024

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - ci

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@azure-sdk

Copy link
Copy Markdown
Collaborator

API change check

API changes are not detected in this pull request.

@simorenoh

Copy link
Copy Markdown
Member

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread sdk/cosmos/azure-cosmos/test/test_query.py Outdated
Comment thread sdk/cosmos/azure-cosmos/test/test_query.py Outdated
Comment thread sdk/cosmos/azure-cosmos/test/test_query_async.py Outdated
Comment thread sdk/cosmos/azure-cosmos/test/test_query_async.py Outdated
@bambriz

bambriz commented Sep 30, 2024

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@bambriz

bambriz commented Sep 30, 2024

Copy link
Copy Markdown
Member Author

/azp run python - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@bambriz
bambriz merged commit ba91013 into Azure:main Oct 2, 2024
Waqas Javed (w-javed) pushed a commit to w-javed/azure-sdk-for-python that referenced this pull request Oct 3, 2024
…ot available retry (Azure#37578)

* Add fixes to 'NoneType' object has no attribute when querying

Fixes 'NoneType' object has no attribute when session retry is triggered and does not succesfully retry while querying.

* Update CHANGELOG.md

* update test files
Libba Lawrence (l0lawrence) pushed a commit to l0lawrence/azure-sdk-for-python that referenced this pull request Feb 19, 2025
…ot available retry (Azure#37578)

* Add fixes to 'NoneType' object has no attribute when querying

Fixes 'NoneType' object has no attribute when session retry is triggered and does not succesfully retry while querying.

* Update CHANGELOG.md

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

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants