Skip to content

Commit 830fac7

Browse files
rennoxdahlerlend
authored andcommitted
BUG#37672626 crash at startup after config-change in jit_executor
When a max ram usage is defined in the configuration, it will be determined how many ram per JavaScript context will be assigned. When starting up, since no contexts have been started, this leads to a zero division, causing the crash in linux. This patch fixes the logic so the calculation is done only if there are active contexts. Change-Id: Ib1169486f3f76e38a9e987073325912dc9fe2c1b
1 parent 1aa22a4 commit 830fac7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

router/src/jit_executor/src/jit_executor_component.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ void JitExecutorComponent::update_active_contexts(
146146
}
147147

148148
// Now updates the memory limit for each active handler and starts it
149-
if (m_global_config.maximum_ram_size.has_value()) {
149+
// Total pool is verified here as it could be 0, meaning, no active context
150+
// handlers will be left after this update
151+
if (total_pool != 0 && m_global_config.maximum_ram_size.has_value()) {
150152
uint64_t mem_per_pool_item = *m_global_config.maximum_ram_size / total_pool;
151153

152154
for (const auto &it : candidate_context_handlers) {

0 commit comments

Comments
 (0)