Fix shutdown ordering in IM integration test #7469
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
What is being fixed?
https://github.com/yunhanw-google/connectedhomeip/actions/runs/919262233
after 2877e1e, which adjust shutdown ordering, we still see shutdown crash for IM test,
[1623175629.106721][155] CHIP:EM: Sending Standalone Ack for MsgId:00000007
[1623175629.106735][155] CHIP:IN: Secure message was encrypted: Msg ID 14
[1623175629.106741][155] CHIP:IN: Sending msg from 0x000000000001B669 to 0x0000000000BC5C01 at utc time: 1231353 msec
[1623175629.106746][155] CHIP:IN: Sending secure msg on generic transport
[1623175629.106779][155] CHIP:IN: Secure msg send status No Error
[1623175629.106784][155] CHIP:EM: Flushed pending ack for MsgId:00000007
[1623175629.106789][155] CHIP:DMG: Client[0] moving to [INIT]
Read Response: 3/3(100.00%) time=0.808ms
[1623175629.106820][145] CHIP:DMG: Client[0] moving to [UNINIT]
[1623175629.106826][145] CHIP:DMG: Client[0] moving to [UNINIT]
[1623175629.106830][145] CHIP:DMG: IM RH moving to [Uninitialized]
chip-im-initiator: ../../../../../src/messaging/ExchangeMgr.cpp:102: chip::Messaging::ExchangeManager::Shutdown()::<lambda(auto:2*)> [with auto:2 = chip::Messaging::ExchangeContext]: Assertion `false' failed.
Thread 1 "chip-im-initiat" received signal SIGABRT, Aborted.
0x00007ffff756118b in raise () from /lib/x86_64-linux-gnu/libc.so.6
#0 0x00007ffff756118b in raise () at /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff7540859 in abort () at /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff7540729 in () at /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff7551f36 in () at /lib/x86_64-linux-gnu/libc.so.6
#4 0x00005555555a2c35 in chip::Messaging::ExchangeManager::<lambda(auto:2*)>::operator()chip::Messaging::ExchangeContext(chip::Messaging::ExchangeContext ) const (__closure=0x7fffffffe417, ec=0x5555555e3e88 <gExchangeManager+360>)
at ../../../../../src/messaging/ExchangeMgr.cpp:102
#5 0x00005555555a2d49 in chip::BitMapObjectPool<chip::Messaging::ExchangeContext, 8>::ForEachActiveObject<chip::Messaging::ExchangeManager::Shutdown()::<lambda(auto:2)> >(chip::Messaging::ExchangeManager::<lambda(auto:2*)>)
(this=0x5555555e3e58 <gExchangeManager+312>, f=...)
at ../../../../../src/lib/support/Pool.h:140
#6 0x00005555555a2225 in chip::Messaging::ExchangeManager::Shutdown()
(this=0x5555555e3d20 )
at ../../../../../src/messaging/ExchangeMgr.cpp:100
#7 0x000055555556a078 in ShutdownChip() ()
at ../../../../../src/app/tests/integration/common.cpp:60
#8 0x0000555555568723 in main(int, char**) (argc=2, argv=0x7fffffffecf8)
at ../../../../../src/app/tests/integration/chip_im_initiator.cpp:458
(gdb) quit
A debugging session is active.
The reason is #7430 only adjust the shutdown ordering for controller, we need similar adjustment in IM integration test apps.
Fixes #7466
Change overview
Adjust the shutdown order and make sure network layer is shutdown first to prevent exchange manager still receive the messages while in a partially torn down state.
Testing
How was this tested? (at least one bullet point required)
Setting up cirque environment
git submodule update --init
./scripts/tests/cirque_tests.sh bootstrap
Run IM Cirque test
./scripts/tests/cirque_tests.sh run_test InteractionModelTest