Skip to content

fix(iot-dev): Timeout stale CBS authentication#1848

Open
arnabnandy7 wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:fix/sas-token-cbs-hang
Open

fix(iot-dev): Timeout stale CBS authentication#1848
arnabnandy7 wants to merge 1 commit into
Azure:mainfrom
arnabnandy7:fix/sas-token-cbs-hang

Conversation

@arnabnandy7

Copy link
Copy Markdown

Checklist

  • I have read the contribution guidelines.
  • I added or modified the existing tests to cover the change (we do not allow our test coverage to go down).
  • I submitted this PR against the correct branch:
    • This pull-request is submitted against the main branch.

Reference/Link to the issue solved with this PR (if any)

Fixes #1802

Description of the problem

When an AMQP connection using SAS token authentication sent a CBS authentication message during proactive token renewal, the SDK scheduled the next renewal immediately but did not track whether the CBS authentication response was ever received.

If the CBS response was lost or never delivered, the client could continue to appear connected while telemetry stopped making progress and messages eventually expired. The only recovery path was an external reconnect, such as restarting the application.

Description of the solution

Added a CBS authentication response timeout to the AMQP SAS token renewal flow. After sending a CBS authentication message, the renewal handler now schedules a timeout based on the configured device operation timeout.

If a successful CBS authentication response arrives before the timeout, the timeout task is cancelled and normal link opening continues. If no response arrives before the timeout, the CBS session is treated as unhealthy and the existing connection recovery path is triggered.

Added unit tests covering both timeout notification and timeout cancellation when an authentication response is received.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The SAS token refreshes every hour, but the CBS link authentication response is not received, preventing messages from being sent.

1 participant