Skip to content

errorReason not cleared on successful re-attach from FAILED (RTL4g) #2214

Description

@paddybyers

Spec requirement

RTL4g: "If the channel is in the FAILED state, the attach request sets its errorReason to null." After a successful re-attach from FAILED, the channel's errorReason should be cleared.

Current behavior

errorReason persists from the FAILED state through a successful re-attach. In realtimechannel.ts line ~843, notifyState() only sets errorReason when reason is truthy:

if (reason) {
  this.errorReason = reason;
}

When a successful ATTACHED arrives (no error), reason is falsy, so the old errorReason from the FAILED state is never cleared.

Root cause

notifyState() in realtimechannel.ts treats errorReason as write-only-on-error. There is no code path that sets it back to null after initial construction (this.errorReason = null in the constructor). The fix would be something like this.errorReason = reason || null; or an explicit clear when entering attached.

Related

  • specification#459 — proposed spec clarification that a successful attach should clear errorReason
  • specification#461 — clarify whether errorReason should be cleared after a clean detach

UTS tests

  • RTL4g - errorReason cleared on re-attach from FAILED in test/uts/realtime/unit/channels/channel_attributes.test.ts
  • RTL4g - errorReason cleared on re-attach and detach in test/uts/realtime/unit/channels/channel_attributes.test.ts
  • RTL4c - errorReason after successful re-attach (deviation) in test/uts/realtime/unit/channels/channel_state_events.test.ts

Found via UTS (Universal Test Specification) compliance testing.

┆Issue is synchronized with this Jira Task by Unito

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working. It's clear that this does need to be fixed.uts-issueIssues raised there there is an apparent discrepancy between this library and the UTS tests

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions