Skip to content

[BUG] DUT becomes operationally unreachable after ConnectNetwork with invalid Thread Network Key and does not re-advertise via mDNS #43560

@r-recchia

Description

@r-recchia

Reproduction steps

During execution of TC-CNET-4.24, the DUT becomes operationally unreachable after attempting to connect to a Thread network using an incorrect network key.

After this failure, the DUT does not re-advertise via mDNS which prevents re-establishing a CASE session.

The same test flow works correctly when valid credentials are used, which suggests the issue is related specifically to the handling of Thread authentication failure and network recovery.

Steps:

  1. Commission the DUT using a valid Thread dataset
  2. Remove all existing networks via NetworkCommissioning.RemoveNetworks
  3. Add a Thread network with an incorrect Network key using AddOrUpdateThreadNetwork(incorrect_dataset)
  4. Attempt to connect to the network ConnectNetwork(networkID=)
  5. The connection attempt fails as expected
  6. Expire the current CASE session
  7. Attempt to rediscover the device via mDNS an re-establish a CASE session

Expected behavior

After a failed connection attempt due to an invalid network key, the DUT should:

  • Remain operationally reachable on the previous network or
  • recover to a state where it re-advertises its operational address via mDNS

This would allow the controller to rediscover the device and re-establish a CASE session.

Observer behavior

After the failed connection attempt (test step 9 and 10):

  • The DUT becomes operationally unreachable
  • The DUT does not re-advertise via operational mDNS
  • the controller cannot rediscover the device
  • CASE session re-establishment fails die to mDNS resolution timeout
[MatterTest] 03-11 15:21:54.299 INFO ***** Test Step 9 : TH sends ConnectNetwork command with dataset containing incorrect Network Key, Breadcrumb = 9
[MatterTest] 03-11 15:21:54.299 INFO <<< [E:48954i S:34386 M:28191156 (Ack:120370211)] (S) Msg TX from 000000000001B669 to 1:0000000012344321 [996D] [UDP:[fd9e:f544:a30:1:edc5:6042:f6df:69e0]:5540] --- Type 0000:10 (SecureChannel:StandaloneAck) (B:34)
[MatterTest] 03-11 15:21:54.299 INFO 		***** Test Step 9 : TH sends ConnectNetwork command with dataset containing incorrect Network Key, Breadcrumb = 9
[MatterTest] 03-11 15:21:54.299 INFO  --- Step 9: Sending ConnectNetwork with incorrect Network Key: 0df9f3ba8f3b1d94
[MatterTest] 03-11 15:21:54.300 INFO Found an existing secure session to [1:0000000012344321]!
[MatterTest] 03-11 15:21:54.300 INFO <<< [E:48955i S:34386 M:28191157] (S) Msg TX from 000000000001B669 to 1:0000000012344321 [996D] [UDP:[fd9e:f544:a30:1:edc5:6042:f6df:69e0]:5540] --- Type 0001:0A (IM:TimedRequest) (B:39)
[MatterTest] 03-11 15:21:54.301 INFO ??1 [E:48955i S:34386 M:28191157] (S) Msg Retransmission to 1:0000000012344321 scheduled for 2387ms from now [State:Active II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:21:54.356 INFO >>> [E:48955i S:34386 M:120370212 (Ack:28191157)] (S) Msg RX from 1:0000000012344321 [996D] to 000000000001B669 --- Type 0001:01 (IM:StatusResponse) (B:42)
[MatterTest] 03-11 15:21:54.356 INFO Received status response, status is 0x00 (SUCCESS)
[MatterTest] 03-11 15:21:54.357 INFO <<< [E:48955i S:34386 M:28191158 (Ack:120370212)] (S) Msg TX from 000000000001B669 to 1:0000000012344321 [996D] [UDP:[fd9e:f544:a30:1:edc5:6042:f6df:69e0]:5540] --- Type 0001:08 (IM:InvokeCommandRequest) (B:77)
[MatterTest] 03-11 15:21:54.357 INFO ??1 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 scheduled for 2203ms from now [State:Active II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:21:56.563 INFO <<1 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321
[MatterTest] 03-11 15:21:56.564 INFO ??2 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 scheduled for 2521ms from now [State:Active II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:21:59.086 INFO <<2 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321
[MatterTest] 03-11 15:21:59.088 INFO ??3 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 scheduled for 3634ms from now [State:Idle II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:22:02.724 INFO <<3 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321
[MatterTest] 03-11 15:22:02.725 INFO ??4 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 scheduled for 5843ms from now [State:Idle II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:22:08.571 INFO <<4 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321
[MatterTest] 03-11 15:22:08.572 INFO ??5 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 scheduled for 9640ms from now [State:Idle II:2000 AI:2000 AT:4000]
[MatterTest] 03-11 15:22:18.213 ERROR <<5 [E:48955i S:34386 M:28191158] (S) Msg Retransmission to 1:0000000012344321 failure (max retries:4)
[MatterTest] 03-11 15:22:28.771 INFO SecureSession[0x13cf066a0, LSID:34386]: State change 'kActive' --> 'kDefunct'
[MatterTest] 03-11 15:22:28.771 INFO Time out! failed to receive invoke command response from Exchange: 48955i
[MatterTest] 03-11 15:22:28.772 INFO  --- ConnectNetwork raised exception: ChipStackError
[MatterTest] 03-11 15:22:28.773 INFO  --- Continuing to observe post-connect network state
[MatterTest] 03-11 15:22:28.773 INFO  --- Expiring CASE sessions after potential network transition
[MatterTest] 03-11 15:22:28.773 INFO StopPairing called for node ID 0x0000000012344321
[MatterTest] 03-11 15:22:28.774 INFO SecureSession[0x13cf066a0, LSID:34386]: State change 'kDefunct' --> 'kPendingEviction'
[MatterTest] 03-11 15:23:08.776 INFO Lookup started for C6A3AC6A98CB996D-0000000012344321
[MatterTest] 03-11 15:23:08.978 INFO Checking node lookup status for C6A3AC6A98CB996D-0000000012344321 after 202 ms
[MatterTest] 03-11 15:23:39.782 ERROR Timeout waiting for mDNS resolution.
[MatterTest] 03-11 15:23:53.776 INFO Checking node lookup status for C6A3AC6A98CB996D-0000000012344321 after 45001 ms
[MatterTest] 03-11 15:23:53.778 ERROR OperationalSessionSetup[1:0000000012344321]: operational discovery failed: src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:124: CHIP Error 0x00000032: Timeout
[MatterTest] 03-11 15:23:53.779 INFO Unable to re-establish CASE session
[MatterTest] 03-11 15:23:53.779 INFO ***** Test Step 10 : TH reads LastNetworkingStatus after Network Key connection failure
[MatterTest] 03-11 15:23:53.779 INFO 		***** Test Step 10 : TH reads LastNetworkingStatus after Network Key connection failure
[MatterTest] 03-11 15:23:53.781 INFO Lookup started for C6A3AC6A98CB996D-0000000012344321
[MatterTest] 03-11 15:23:53.980 INFO Checking node lookup status for C6A3AC6A98CB996D-0000000012344321 after 200 ms
[MatterTest] 03-11 15:24:24.788 ERROR Timeout waiting for mDNS resolution.
[MatterTest] 03-11 15:24:38.782 INFO Checking node lookup status for C6A3AC6A98CB996D-0000000012344321 after 45002 ms
[MatterTest] 03-11 15:24:38.783 ERROR OperationalSessionSetup[1:0000000012344321]: operational discovery failed: src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:124: CHIP Error 0x00000032: Timeout
[MatterTest] 03-11 15:24:38.785 ERROR Exception occurred in test_TC_CNET_4_24.
Traceback (most recent call last):
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/mobly/base_test.py", line 801, in exec_one_test
    test_method()
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/testing/decorators.py", line 265, in async_runner
    return _async_runner(body, self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/testing/decorators.py", line 253, in _async_runner
    return test_instance.event_loop.run_until_complete(asyncio.wait_for(body(test_instance, *args, **kwargs), timeout=timeout))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/.environment/cipd/packages/pigweed/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/.environment/cipd/packages/pigweed/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/src/python_testing/TC_CNET_4_24.py", line 612, in test_TC_CNET_4_24
    await self._read_last_networking_status(
  File "/Users/ramiro/Documents/Matter/connectedhomeip/src/python_testing/TC_CNET_4_24.py", line 220, in _read_last_networking_status
    status = await self.read_single_attribute(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/testing/matter_testing.py", line 930, in read_single_attribute
    result = await dev_ctrl.ReadAttribute(node_id, [(endpoint, attribute)], fabricFiltered=fabricFiltered)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/ChipDeviceCtrl.py", line 2346, in ReadAttribute
    res = await self.Read(nodeId,
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/ChipDeviceCtrl.py", line 2246, in Read
    device = await self.GetConnectedDevice(nodeId, payloadCapability=payloadCapability)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/ChipDeviceCtrl.py", line 1592, in GetConnectedDevice
    await future
matter.exceptions.ChipStackError: src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:124: CHIP Error 0x00000032: Timeout
[MatterTest] 03-11 15:24:38.807 INFO 		***** Test Failure : 
[MatterTest] 03-11 15:24:38.807 INFO Finished test in 218052636.0ms
[MatterTest] 03-11 15:24:38.808 ERROR 

******************************************************************
*
* Test test_TC_CNET_4_24 failed for the following reason:
* src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:124: CHIP Error 0x00000032: Timeout
*
* File "/Users/ramiro/Documents/Matter/connectedhomeip/out/python_env/lib/python3.11/site-packages/matter/ChipDeviceCtrl.py", line 1592, in GetConnectedDevice
* matter.exceptions.ChipStackError: src/lib/address_resolve/AddressResolve_DefaultImpl.cpp:124: CHIP Error 0x00000032: Timeout
*
* Test step:
*     10: TH reads LastNetworkingStatus after Network Key connection failure	Expected outcome: Verify LastNetworkingStatus is kAuthFailure (7)
*
* Endpoint: None
*
*******************************************************************

[MatterTest] 03-11 15:24:38.808 INFO [Test] test_TC_CNET_4_24 ERROR
[MatterTest] 03-11 15:24:38.813 INFO Summary for test class TC_CNET_4_24: Error 1, Executed 1, Failed 0, Passed 0, Requested 1, Skipped 0
[MatterTest] 03-11 15:24:38.813 INFO Summary for test run MatterTest@03-11-2026_15-20-49-240:
Total time elapsed 229.572251125006s
Artifacts are saved in "/tmp/matter_testing/logs/MatterTest/03-11-2026_15-20-49-240"
Test summary saved in "/tmp/matter_testing/logs/MatterTest/03-11-2026_15-20-49-240/test_summary.yaml"
Test results: Error 1, Executed 2, Failed 0, Passed 1, Requested 2, Skipped 0
Shutting down the stack...
Final result: FAIL !

PR TC-CNET-4.24 explains how to set up the environment (raspberry, thread network, dongle and EFR)

Bug prevalence

When I run the test locally

GitHub hash of the SDK that was being used

19c17d7

Platform

efr32

Platform Version(s)

No response

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions