Skip to content

Commit 08073f6

Browse files
authored
Update signalDecoder.cpp: Fix OOM crash caused by rtl_433_Decoder_Stack to small on Lilygo Lora device (#156)
This fixes the crash caused by OOM when low water mark on rtl_433_Decder_Stack drops below 0. (See: 1technophile/OpenMQTTGateway#2043) I increased the memory size by 1500 which after running for a week on 2 different Lilygo Lora ESP32 devices leaves the water mark at just over 1KB -- I want to leave a little spare in case there are other sensor configurations and edge cases that would dip further into the stack. I also wrapped the definitions of `rtl_433_Decoder_stack` with `ifndef rtl_433_Decoder_Stack` so that users can easily manually tweak the allocated stack size for their own particular situations.
1 parent d0d10a5 commit 08073f6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/signalDecoder.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@
2727

2828
/*----------------------------- rtl_433_ESP Internals -----------------------------*/
2929

30-
#if defined(RTL_ANALYZER) || defined(RTL_ANALYZE)
31-
# define rtl_433_Decoder_Stack 60000
32-
#elif defined(RTL_VERBOSE) || defined(RTL_DEBUG)
33-
# define rtl_433_Decoder_Stack 30000
34-
#else
35-
# if OOK_MODULATION
36-
# define rtl_433_Decoder_Stack 10000
30+
#ifndef rtl_433_Decoder_Stack
31+
# if defined(RTL_ANALYZER) || defined(RTL_ANALYZE)
32+
# define rtl_433_Decoder_Stack 60000
33+
# elif defined(RTL_VERBOSE) || defined(RTL_DEBUG)
34+
# define rtl_433_Decoder_Stack 30000
3735
# else
38-
# define rtl_433_Decoder_Stack 20000
36+
# if OOK_MODULATION
37+
# define rtl_433_Decoder_Stack 11500
38+
# else
39+
# define rtl_433_Decoder_Stack 20000
40+
# endif
3941
# endif
4042
#endif
4143

@@ -575,4 +577,4 @@ void processSignal(pulse_data_t* rtl_pulses) {
575577
} else {
576578
// logprintfLn(LOG_DEBUG, "processSignal() signal placed on rtl_433_Queue");
577579
}
578-
}
580+
}

0 commit comments

Comments
 (0)