You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After last service has been resolved the test case calls chip::DeviceLayer::PlatformMgr().Shutdown() without waiting for event loop termination. So, from time to time we've got race condition with abort:
[1681807067.000859][1049843:1049844] CHIP:DL: Avahi resolve found
Service[8] at [127.0.0.1]:80
[1681807067.002774][1049843:1049844] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-vRqojS)
[1681807067.002981][1049843:1049844] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1681807067.003022][1049843:1049844] CHIP:DL: NVS set: chip-counters/total-operational-hours = 0 (0x0)
[1681807067.003045][1049843:1049844] CHIP:SPT: VerifyOrDie failure at src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp:312: mState.load(std::memory_order_relaxed) == State::kStopped
Aborted (core dumped)
It happens because the chip::DeviceLayer::PlatformMgr().StopEventLoopTask() is called on the Matter thread, so this call can not wait for "self-thread join".
Changes
add Setup and Teardown for test runner (share matter stack between test cases added in the future)
do not call Shutdown() and exit() on the Matter thread
use dedicated browse context instead of global variables
Testing
Tested on Linux with avahi:
[1681807644.570791][1065218:1065219] CHIP:DL: Avahi resolve found
Service[8] at [127.0.0.1]:80
[1681807644.571849][1065218:1065219] CHIP:DL: End EventLoop
'#3:','Test Dnssd::PubSub','PASSED'
'#6:','0','1'
'#7:','0','59'
[1681807644.573872][1065218:1065218] CHIP:DL: writing settings to file (/tmp/chip_counters.ini-733Ciz)
[1681807644.574124][1065218:1065218] CHIP:DL: renamed tmp file to file (/tmp/chip_counters.ini)
[1681807644.574194][1065218:1065218] CHIP:DL: NVS set: chip-counters/total-operational-hours = 0 (0x0)
[1681807644.574221][1065218:1065218] CHIP:DL: Inet Layer shutdown
[1681807644.574241][1065218:1065218] CHIP:DL: BLE shutdown
[1681807644.574314][1065218:1065218] CHIP:DL: System Layer shutdown
'#4:','Teardown ','PASSED'
'#6:','0','1'
'#7:','0','61'
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
After last service has been resolved the test case calls
chip::DeviceLayer::PlatformMgr().Shutdown()
without waiting for event loop termination. So, from time to time we've got race condition with abort:It happens because the
chip::DeviceLayer::PlatformMgr().StopEventLoopTask()
is called on the Matter thread, so this call can not wait for "self-thread join".Changes
Setup
andTeardown
for test runner (share matter stack between test cases added in the future)Shutdown()
andexit()
on the Matter threadTesting
Tested on Linux with avahi: