From b5e1b18d364c9a46e49950f98325cddf3a5c854f Mon Sep 17 00:00:00 2001 From: Gavin Halliday Date: Fri, 25 Oct 2024 12:00:29 +0100 Subject: [PATCH] HPCC-32877 Fix abort in esp when accessing secrets from a vault The vault secret code uses httplib to request entries from a vault. The default compilation mode is to use select() rather than poll(), but select() has a limit of 1024 sockets. That means that if a process has a large number of sockets (or files?) open the select based code will fail. This commit defines CPPHTTPLIB_USE_POLL which enables the use of poll() Signed-off-by: Gavin Halliday --- system/jlib/CMakeLists.txt | 3 +++ system/metrics/sinks/prometheus/CMakeLists.txt | 3 +++ 2 files changed, 6 insertions(+) diff --git a/system/jlib/CMakeLists.txt b/system/jlib/CMakeLists.txt index 9fa8175eabc..1a88f03d3a1 100644 --- a/system/jlib/CMakeLists.txt +++ b/system/jlib/CMakeLists.txt @@ -223,6 +223,9 @@ include_directories ( ${CMAKE_BINARY_DIR}/oss ) +# ensure httplib uses poll rather than select - otherwise it fail if too many sockets have been opened. +ADD_DEFINITIONS( -DCPPHTTPLIB_USE_POLL ) + ADD_DEFINITIONS( -D_USRDLL -DJLIB_EXPORTS ) HPCC_ADD_LIBRARY( jlib SHARED ${SRCS} ${INCLUDES} ) diff --git a/system/metrics/sinks/prometheus/CMakeLists.txt b/system/metrics/sinks/prometheus/CMakeLists.txt index c2454e1eadc..f2a89ad3f2d 100644 --- a/system/metrics/sinks/prometheus/CMakeLists.txt +++ b/system/metrics/sinks/prometheus/CMakeLists.txt @@ -30,6 +30,9 @@ include_directories( ${HPCC_SOURCE_DIR}/system/httplib ) +# ensure httplib uses poll rather than select - otherwise it fail if too many sockets have been opened. +ADD_DEFINITIONS( -DCPPHTTPLIB_USE_POLL ) + SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${STRICT_CXX_FLAGS}") ADD_DEFINITIONS( -DPROMETHEUSSINK_EXPORTS ) HPCC_ADD_LIBRARY( hpccmetrics_prometheussink SHARED ${srcs} )