Skip to content

Commit c8c8c73

Browse files
MarekPietarlubos
authored andcommitted
app_event_manager: Improve OOM error handling
Change improves out of memory error handling for default application event allocator. The CONFIG_APP_EVENT_MANAGER_REBOOT_ON_EVENT_ALLOC_FAIL Kconfig option was introduced to allow user to select between system reboot or kernel panic. Signed-off-by: Marek Pieta <[email protected]> Signed-off-by: Pekka Niskanen <[email protected]>
1 parent 23d933c commit c8c8c73

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

+5
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,11 @@ Other libraries
371371

372372
* Added the :ref:`lib_uart_async_adapter` library.
373373

374+
* :ref:`app_event_manager`:
375+
376+
* Added the :kconfig:option:`CONFIG_APP_EVENT_MANAGER_REBOOT_ON_EVENT_ALLOC_FAIL` Kconfig option.
377+
The option allows to select between system reboot or kernel panic on event allocation failure for default event allocator.
378+
374379
Common Application Framework (CAF)
375380
----------------------------------
376381

subsys/app_event_manager/Kconfig

+10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ menuconfig APP_EVENT_MANAGER
1212

1313
if APP_EVENT_MANAGER
1414

15+
config APP_EVENT_MANAGER_REBOOT_ON_EVENT_ALLOC_FAIL
16+
bool "Reboot on event allocation failure"
17+
depends on REBOOT
18+
default y
19+
help
20+
The default event allocator triggers assertion failure on event
21+
allocation failure. Then, depending on the value of this Kconfig
22+
option, the default allocator either triggers a system reboot or
23+
kernel panic.
24+
1525
config APP_EVENT_MANAGER_SHOW_EVENTS
1626
bool "Show events"
1727
depends on LOG

subsys/app_event_manager/app_event_manager.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void * __weak app_event_manager_alloc(size_t size)
121121
if (unlikely(!event)) {
122122
LOG_ERR("Application Event Manager OOM error\n");
123123
__ASSERT_NO_MSG(false);
124-
if (IS_ENABLED(CONFIG_REBOOT)) {
124+
if (IS_ENABLED(CONFIG_APP_EVENT_MANAGER_REBOOT_ON_EVENT_ALLOC_FAIL)) {
125125
sys_reboot(SYS_REBOOT_WARM);
126126
} else {
127127
k_panic();

0 commit comments

Comments
 (0)