pixie icon indicating copy to clipboard operation
pixie copied to clipboard

Fix negative table size calculation when socket tracer disabled via stirling flag

Open benkilimnik opened this issue 1 year ago • 1 comments

Summary: When some or all of the tables http_events, stirling_error, probe_status, proc_exit_events are disabled via stirling flags (PL_STIRLING_SOURCES=...) the other_table_size calculation returns a negative output if num_tables < 4. It also attempts division by zero when num_tables = 4

  int64_t other_table_size = (memory_limit - http_table_size - stirling_error_table_size -
                              probe_status_table_size - proc_exit_events_table_size) /
                             (num_tables - 4);

This PR streamlines the table size calculation and fixes the edge condition.

Type of change: /kind bug

Test Plan: deployed to node and manually checked calculated table sizes.

benkilimnik avatar May 06 '24 22:05 benkilimnik

Just pushed an update to also fix table size calculations in pem_manager.cc and add an error condition for when the pem flags are set such that there is not enough space for the default tables.

  if (remaining_memory < 0) {
    return error::Internal("Table store data limit is too low to store the tables.");
  }

benkilimnik avatar May 09 '24 21:05 benkilimnik