Skip to content

Commit d5773a2

Browse files
Pull request project-chip#2100: Fix deadlock between chip task blocked because 917 nvm3 store can't completeas it also waits on a event to be process by chip task
Merge in WMN_TOOLS/matter from fix/917_deadlock to RC_2.3.1-1.3 Squashed commit of the following: commit b6d75e6aefd494faca9f1ce4c499087b44521805 Author: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Fri Jan 24 14:02:24 2025 -0500 Fix deadlock between chip task blocked because 917 nvm3 store can't complete wait as it also way on event to be process by chip task
1 parent e8306c9 commit d5773a2

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

src/platform/silabs/KeyValueStoreManagerImpl.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,14 @@ void KeyValueStoreManagerImpl::ScheduleKeyMapSave(void)
164164
During commissioning, the key map will be modified multiples times subsequently.
165165
Commit the key map in nvm once it as stabilized.
166166
*/
167-
#if SLI_SI91X_MCU_INTERFACE && CHIP_CONFIG_ENABLE_ICD_SERVER
168-
// TODO: Remove this when RTC timer is added MATTER-2705
169-
SilabsConfig::WriteConfigValueBin(SilabsConfig::kConfigKey_KvsStringKeyMap, reinterpret_cast<const uint8_t *>(mKvsKeyMap),
170-
sizeof(mKvsKeyMap));
167+
#if SLI_SI91X_MCU_INTERFACE
168+
// Avoid risk of deadlock by saving the key map immediately
169+
ForceKeyMapSave();
171170
#else
172171
SystemLayer().StartTimer(
173172
std::chrono::duration_cast<System::Clock::Timeout>(System::Clock::Seconds32(SL_KVS_SAVE_DELAY_SECONDS)),
174173
KeyValueStoreManagerImpl::OnScheduledKeyMapSave, NULL);
175-
#endif // defined(SLI_SI91X_MCU_INTERFACE) && CHIP_CONFIG_ENABLE_ICD_SERVER
174+
#endif // defined(SLI_SI91X_MCU_INTERFACE)
176175
}
177176

178177
CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size,

src/platform/silabs/SiWx917/wifi/wfx_notify.cpp

+2-10
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,7 @@ void wfx_ipv6_notify(int got_ip)
155155
/* So the other threads can run and have the connectivity OK */
156156
if (got_ip)
157157
{
158-
/* Should remember this */
159-
vTaskDelay(1);
160-
chip::DeviceLayer::PlatformMgr().LockChipStack();
161-
chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/);
162-
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
158+
DeviceLayer::SystemLayer().ScheduleLambda([] { app::DnssdServer::Instance().StartServer(); });
163159
}
164160
}
165161

@@ -184,11 +180,7 @@ void wfx_ip_changed_notify(int got_ip)
184180
/* So the other threads can run and have the connectivity OK */
185181
if (got_ip)
186182
{
187-
/* Should remember this */
188-
vTaskDelay(1);
189-
chip::DeviceLayer::PlatformMgr().LockChipStack();
190-
chip::app::DnssdServer::Instance().StartServer(/*Dnssd::CommissioningMode::kEnabledBasic*/);
191-
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
183+
DeviceLayer::SystemLayer().ScheduleLambda([] { app::DnssdServer::Instance().StartServer(); });
192184
}
193185
}
194186

0 commit comments

Comments
 (0)