Skip to content

Commit

Permalink
issue: 4260620 infinite loop latency spec
Browse files Browse the repository at this point in the history
When there are no offloaded sockets, we mistakingly poll for
offloaded sockets in case VMA_SELECT_POLL_OS_FORCE=1.

This behavior makes us getting stuck in an infinite loop.

This patch fixes the issue by polling OS sockets
in the case there are no offloaded sockets
regardless to VMA_SELECT_POLL_OS_FORCE value.

Signed-off-by: Tomer Cabouly <[email protected]>
  • Loading branch information
tomerdbz committed Jan 21, 2025
1 parent 1849e0a commit e221d58
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ Where value of 0 is used for no polling (interrupt driven)
Default value is 100000

VMA_SELECT_POLL_OS_FORCE
This flag forces to poll the OS file descriptors while user thread calls
select(), poll() or epoll_wait() even when no offloaded sockets are mapped.
NOTE:
This is a DEPRECATED configuration parameter that will be removed from future libvma releases.
Enabling this flag causes VMA to set VMA_SELECT_POLL_OS_RATIO and
VMA_SELECT_SKIP_OS to 1. This will result in VMA_SELECT_POLL number of
times VMA will poll the OS file descriptors, along side with offloaded
Expand Down
4 changes: 1 addition & 3 deletions src/vma/iomux/io_mux_call.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ io_mux_call::io_mux_call(int *off_fds_buffer, offloaded_mode_t *off_modes_buffer
m_n_sysvar_select_skip_os_fd_check(safe_mce_sys().select_skip_os_fd_check),
m_n_sysvar_select_poll_os_ratio(safe_mce_sys().select_poll_os_ratio),
m_n_sysvar_select_poll_num(safe_mce_sys().select_poll_num),
m_b_sysvar_select_poll_os_force(safe_mce_sys().select_poll_os_force),
m_b_sysvar_select_handle_cpu_usage_stats(safe_mce_sys().select_handle_cpu_usage_stats),
m_p_all_offloaded_fds(off_fds_buffer),
m_p_offloaded_modes(off_modes_buffer),
Expand Down Expand Up @@ -469,8 +468,7 @@ int io_mux_call::call()

__log_funcall("");

if (!m_b_sysvar_select_poll_os_force // TODO: evaluate/consider this logic
&& (*m_p_num_all_offloaded_fds == 0))
if (*m_p_num_all_offloaded_fds == 0)
{
// 1st scenario
timer_update();
Expand Down
1 change: 0 additions & 1 deletion src/vma/iomux/io_mux_call.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ class io_mux_call
const uint32_t m_n_sysvar_select_skip_os_fd_check;
const uint32_t m_n_sysvar_select_poll_os_ratio;
const int32_t m_n_sysvar_select_poll_num;
const bool m_b_sysvar_select_poll_os_force;
const bool m_b_sysvar_select_handle_cpu_usage_stats;

public:
Expand Down
1 change: 0 additions & 1 deletion src/vma/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,6 @@ void print_vma_global_settings()
VLOG_PARAM_STRING("Force Flowtag for MC", safe_mce_sys().mc_force_flowtag, MCE_DEFAULT_MC_FORCE_FLOWTAG, SYS_VAR_MC_FORCE_FLOWTAG, safe_mce_sys().mc_force_flowtag ? "Enabled " : "Disabled");

VLOG_PARAM_NUMBER("Select Poll (usec)", safe_mce_sys().select_poll_num, MCE_DEFAULT_SELECT_NUM_POLLS, SYS_VAR_SELECT_NUM_POLLS);
VLOG_PARAM_STRING("Select Poll OS Force", safe_mce_sys().select_poll_os_force, MCE_DEFAULT_SELECT_POLL_OS_FORCE, SYS_VAR_SELECT_POLL_OS_FORCE, safe_mce_sys().select_poll_os_force ? "Enabled " : "Disabled");

if (safe_mce_sys().select_poll_os_ratio) {
VLOG_PARAM_NUMBER("Select Poll OS Ratio", safe_mce_sys().select_poll_os_ratio, MCE_DEFAULT_SELECT_POLL_OS_RATIO, SYS_VAR_SELECT_POLL_OS_RATIO);
Expand Down
4 changes: 2 additions & 2 deletions src/vma/util/sys_vars.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,8 @@ void mce_sys_var::get_env_params()
mem_alloc_type = ALLOC_TYPE_HUGEPAGES; //MCE_DEFAULT_MEM_ALLOC_TYPE (ALLOC_TYPE_CONTIG)
strcpy(internal_thread_affinity_str, "0"); //MCE_DEFAULT_INTERNAL_THREAD_AFFINITY_STR ("-1")
progress_engine_interval_msec = 100; //MCE_DEFAULT_PROGRESS_ENGINE_INTERVAL_MSEC (10)
select_poll_os_ratio = 100; //MCE_DEFAULT_SELECT_POLL_OS_RATIO (10)
select_poll_os_force = 1; //MCE_DEFAULT_SELECT_POLL_OS_FORCE (0)
select_poll_os_ratio = 1; //MCE_DEFAULT_SELECT_POLL_OS_RATIO (10)
select_skip_os_fd_check = 1; //MCE_DEFAULT_SELECT_SKIP_OS (4)
tcp_nodelay = true; // MCE_DEFAULT_TCP_NODELAY (falst)
ring_dev_mem_tx = 16384; // MCE_DEFAULT_RING_DEV_MEM_TX (0)
break;
Expand Down

0 comments on commit e221d58

Please sign in to comment.