diff --git a/cmake/ChaoticGen.cmake b/cmake/ChaoticGen.cmake index 5302daf51038..3f8828ae0c3e 100644 --- a/cmake/ChaoticGen.cmake +++ b/cmake/ChaoticGen.cmake @@ -136,7 +136,7 @@ function(userver_target_generate_chaotic TARGET) if(PARSE_PARSE_EXTRA_FORMATS) list(APPEND CHAOTIC_ARGS "--parse-extra-formats") endif() - + if(PARSE_NO_SAX_PARSE) list(APPEND CHAOTIC_ARGS "--no-sax-parse") endif() diff --git a/conanfile.py b/conanfile.py index 8d4f042ad106..7f36f8be5a7f 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,6 +1,7 @@ # pylint: disable=no-member import os import platform +import re from conan import ConanFile from conan.errors import ConanInvalidConfiguration @@ -12,6 +13,8 @@ from conan.tools.files import copy from conan.tools.files import export_conandata_patches from conan.tools.files import get +from conan.tools.files import load +from conan.tools.system import package_manager from conan.tools.scm import Git required_conan_version = '>=2.8.0' # pylint: disable=invalid-name @@ -78,6 +81,17 @@ class UserverConan(ConanFile): 're2/*:with_icu': True, } + def set_version(self): + content = load( + self, + os.path.join( + os.path.dirname(os.path.realpath(__file__)), + 'version.txt', + ), + ) + hotfix_version = '4' + self.version = content.strip() + f".{hotfix_version}" # pylint: disable=attribute-defined-outside-init + def source(self): known_version = (self.conan_data or {}).get('sources', {}).get(self.version) if known_version: @@ -102,31 +116,38 @@ def export_sources(self): def layout(self): cmake_layout(self) + def configure(self): + # Control dependencies of our dependencies based on current options + if self.options.with_jemalloc: + self.options['jemalloc'].enable_prof = True + def requirements(self): - self.requires('boost/[>=1.83 <1.88]', transitive_headers=True) + self.requires('boost/1.90.0', transitive_headers=True, options={ + "with_stacktrace_backtrace": True, + "without_stacktrace": False, + "without_cobalt": True + }) self.requires('c-ares/[^1.33]') self.requires('cctz/[^2.4]', transitive_headers=True) - self.requires('concurrentqueue/[^1.0.5]', transitive_headers=True) - self.requires('cryptopp/[^8.9]') - self.requires('fmt/[>=8.1.1 <13]', transitive_headers=True) + self.requires('fmt/11.2.0', transitive_headers=True) self.requires('libiconv/[^1.17]') self.requires('libnghttp2/[^1.61]') - self.requires('libcurl/[>=7.86.0 <7.88 || >8.1.2]') + self.requires('libcurl/8.12.1') self.requires('libev/[^4.33]') - self.requires('openssl/[>=1.1 <4]') + self.requires('openssl/[>=3.6.2 <4]') self.requires('rapidjson/[>=cci.20230929 =0.8.0 <=0.9.0]') self.requires('zlib/[^1.3]') self.requires('zstd/[^1.5]') self.requires('icu/[>=74.1 <77]', force=True) - self.requires('re2/[>=20230301]') + self.requires('re2/[>=20251105]') if self.options.with_jemalloc: self.requires('jemalloc/[^5.3]') if self.options.with_grpc or self.options.with_clickhouse: - self.requires('abseil/20240722.1', force=True) + self.requires('abseil/20260107.1', transitive_headers=True, transitive_libs=True, force=True) if self.options.with_grpc: self.requires( 'grpc/[^1.69.0]', @@ -134,7 +155,7 @@ def requirements(self): transitive_libs=True, ) self.requires( - 'protobuf/[^5.27]', + 'protobuf/6.33.5', transitive_headers=True, transitive_libs=True, force=True, @@ -145,12 +166,12 @@ def requirements(self): # without system package. We use system package. # # `<16` is due to link errors `undefined reference to `gss_release_buffer'` - self.requires('libpq/[>=14.9 <16]') + self.requires('libpq/[>=15.17 <16]') if self.options.with_mongodb or self.options.with_kafka: self.requires('cyrus-sasl/[^2.1]') if self.options.with_mongodb: self.requires( - 'mongo-c-driver/[^1.30]', + 'mongo-c-driver/1.30.3', transitive_headers=True, transitive_libs=True, ) @@ -170,7 +191,7 @@ def requirements(self): transitive_libs=True, ) self.requires( - 'benchmark/[>=1.9 <3]', + 'benchmark/[>=1.9.5 <3]', transitive_headers=True, transitive_libs=True, ) diff --git a/core/include/userver/utils/statistics/system_statistics.hpp b/core/include/userver/utils/statistics/system_statistics.hpp new file mode 100644 index 000000000000..b91dd41a22af --- /dev/null +++ b/core/include/userver/utils/statistics/system_statistics.hpp @@ -0,0 +1,29 @@ +#pragma once + +#include +#include +#include + +#include + +USERVER_NAMESPACE_BEGIN + +namespace utils::statistics::impl { + +struct SystemStats { + std::optional cpu_time_sec; + std::optional rss_kb; + std::optional open_files; + std::optional major_pagefaults; + std::optional io_read_bytes; + std::optional io_write_bytes; +}; + +void DumpMetric(Writer& writer, const SystemStats& stats); + +SystemStats GetSelfSystemStatistics(); +SystemStats GetSystemStatisticsByExeName(std::string_view name); + +} // namespace utils::statistics::impl + +USERVER_NAMESPACE_END diff --git a/core/include/userver/utils/statistics/system_statistics_collector.hpp b/core/include/userver/utils/statistics/system_statistics_collector.hpp index 59eed687ba64..9f5d1ef70f72 100644 --- a/core/include/userver/utils/statistics/system_statistics_collector.hpp +++ b/core/include/userver/utils/statistics/system_statistics_collector.hpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include USERVER_NAMESPACE_BEGIN diff --git a/core/src/components/run.cpp b/core/src/components/run.cpp index a8de04730048..f85a2fd42953 100644 --- a/core/src/components/run.cpp +++ b/core/src/components/run.cpp @@ -205,7 +205,13 @@ void CatchSignalsLoop(impl::Manager& manager, RunMode run_mode, utils::SignalCat } else if (signum == SIGUSR1 || signum == SIGUSR2) { LOG_INFO() << "Signal caught: " << utils::strsignal(signum); manager.OnSignal(signum); - } else { + } +#ifdef __APPLE__ + else if(signum == -1){ + LOG_WARNING() << "sigwait false positive, ingnoring... "; + } +#endif + else { LOG_WARNING() << "Got unexpected signal: " << signum << " (" << utils::strsignal(signum) << ')'; UASSERT_MSG(false, "unexpected signal"); } diff --git a/core/src/server/http/http_request_parser.cpp b/core/src/server/http/http_request_parser.cpp index a2469413477c..ac01b4569eeb 100644 --- a/core/src/server/http/http_request_parser.cpp +++ b/core/src/server/http/http_request_parser.cpp @@ -31,7 +31,7 @@ bool IsWebSocketUpgradeRequest(std::string_view req) { if (it == req.end()) { return false; } - while (*it == ' ' && it != req.end()) { + while (it != req.end() && (*it == ' ' || *it == '\t')) { ++it; } const auto end = it + kWebsocketUpgradeHeaderValue.size(); diff --git a/core/src/tracing/span.cpp b/core/src/tracing/span.cpp index 457e73064cea..a9ffd51c5903 100644 --- a/core/src/tracing/span.cpp +++ b/core/src/tracing/span.cpp @@ -126,7 +126,7 @@ Span::Impl::Impl( ) : name_(std::move(name)), is_no_log_span_(IsNoLogSpan(name_)), - log_level_(is_no_log_span_ ? logging::Level::kNone : logging::Level::kInfo), + log_level_(is_no_log_span_ ? logging::Level::kNone : logging::Level::kTrace), reference_type_(reference_type), source_location_(source_location), trace_id_(parent ? utils::SmallString(parent->GetTraceId()) : GenerateTraceId()), diff --git a/core/src/utils/periodic_task.cpp b/core/src/utils/periodic_task.cpp index fff6ffe7f753..aa2e3fb95bc3 100644 --- a/core/src/utils/periodic_task.cpp +++ b/core/src/utils/periodic_task.cpp @@ -128,12 +128,12 @@ void PeriodicTask::Stop() noexcept { const auto name = impl_->GetName(); try { if (IsRunning()) { - LOG_INFO() << "Stopping PeriodicTask with name=" << name; + LOG_DEBUG() << "Stopping PeriodicTask with name=" << name; impl_->task.SyncCancel(); impl_->changed_event.Reset(); impl_->should_force_step = false; impl_->task = engine::TaskWithResult(); - LOG_INFO() << "Stopped PeriodicTask with name=" << name; + LOG_DEBUG() << "Stopped PeriodicTask with name=" << name; } } catch (std::exception& e) { LOG_ERROR() << "Exception while stopping PeriodicTask with name=" << name << ": " << e; diff --git a/core/src/utils/signal_catcher.cpp b/core/src/utils/signal_catcher.cpp index 2383ae02ee4f..f14344776218 100644 --- a/core/src/utils/signal_catcher.cpp +++ b/core/src/utils/signal_catcher.cpp @@ -22,7 +22,12 @@ SignalCatcher::~SignalCatcher() noexcept(false) { int SignalCatcher::Catch() { int signum = -1; utils::CheckSyscall(sigwait(&sigset_, &signum), "waiting for signal"); + //https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/sigwait.2.html + //on mac os sigwait sometime returns 0 value(success) and signum -1 + //looks like a bug +#ifndef __APPLE__ UASSERT(signum != -1); +#endif return signum; } diff --git a/core/src/utils/statistics/impl/histogram_view_utils.hpp b/core/src/utils/statistics/impl/histogram_view_utils.hpp index 28f18ee279a7..a5be4cffb19a 100644 --- a/core/src/utils/statistics/impl/histogram_view_utils.hpp +++ b/core/src/utils/statistics/impl/histogram_view_utils.hpp @@ -54,7 +54,7 @@ inline void AddNonAtomic(std::atomic& to, std::uint64_t x) { } inline void AddAtomic(std::atomic& to, double x) { -#if __cplusplus >= 202002L && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 180000) +#if !defined(__APPLE__) && __cplusplus >= 202002L && (!defined(_LIBCPP_VERSION) || _LIBCPP_VERSION >= 180000) to += x; #else double expected = to.load(); diff --git a/core/src/utils/statistics/system_statistics.cpp b/core/src/utils/statistics/system_statistics.cpp index 0a6609b64c9a..5a4d1af367ca 100644 --- a/core/src/utils/statistics/system_statistics.cpp +++ b/core/src/utils/statistics/system_statistics.cpp @@ -1,4 +1,4 @@ -#include +#include #ifdef __APPLE__ #include diff --git a/grpc/src/ugrpc/client/client_factory_component.cpp b/grpc/src/ugrpc/client/client_factory_component.cpp index daef60bd7933..8a8333a3d92f 100644 --- a/grpc/src/ugrpc/client/client_factory_component.cpp +++ b/grpc/src/ugrpc/client/client_factory_component.cpp @@ -142,6 +142,11 @@ ClientFactoryComponent::ClientFactoryComponent( ClientFactory& ClientFactoryComponent::GetFactory() { return *factory_; } yaml_config::Schema ClientFactoryComponent::GetStaticConfigSchema() { + /* + * auth-token: + type: string + description: auth token name from secdist + */ return yaml_config::MergeSchemasFromResource< impl::MiddlewareRunnerComponentBase>("src/ugrpc/client/client_factory_component.yaml"); } diff --git a/grpc/src/ugrpc/client/impl/client_factory_config.cpp b/grpc/src/ugrpc/client/impl/client_factory_config.cpp index da5835385722..044a42da35c0 100644 --- a/grpc/src/ugrpc/client/impl/client_factory_config.cpp +++ b/grpc/src/ugrpc/client/impl/client_factory_config.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include USERVER_NAMESPACE_BEGIN diff --git a/grpc/src/ugrpc/server/service_component_base.cpp b/grpc/src/ugrpc/server/service_component_base.cpp index a905473054e3..98798eb341de 100644 --- a/grpc/src/ugrpc/server/service_component_base.cpp +++ b/grpc/src/ugrpc/server/service_component_base.cpp @@ -1,3 +1,5 @@ +#include +#include #include #include @@ -22,14 +24,25 @@ USERVER_NAMESPACE_BEGIN -namespace ugrpc::server { +namespace { + +std::string GetServerName(const components::ComponentConfig& config) { + static constexpr std::string_view kServerNameKey = "server-name"; + if (config.HasMember(kServerNameKey)) { + return config[kServerNameKey].As(); + } + return "grpc-server"; +} +} // namespace + +namespace ugrpc::server { ServiceComponentBase::ServiceComponentBase( const components::ComponentConfig& config, const components::ComponentContext& context ) : impl::MiddlewareRunnerComponentBase(config, context, MiddlewarePipelineComponent::kName), - server_(context.FindComponent()), + server_(context.FindComponent(GetServerName(config))), config_(server_.ParseServiceConfig(config, context)), component_name_(context.GetComponentName()) {} diff --git a/grpc/src/ugrpc/server/service_component_base.yaml b/grpc/src/ugrpc/server/service_component_base.yaml index 2ebab67b8efd..36ad7dd7e445 100644 --- a/grpc/src/ugrpc/server/service_component_base.yaml +++ b/grpc/src/ugrpc/server/service_component_base.yaml @@ -6,6 +6,10 @@ properties: type: string description: the task processor to use for responses default: uses grpc-server.service-defaults.task-processor + server-name: + type: string + description: the name of the server to use + defaultDescription: grpc-server status-codes-log-level: type: object properties: {} diff --git a/universal/CMakeLists.txt b/universal/CMakeLists.txt index e8b6e73a3a8f..09f97605d58a 100644 --- a/universal/CMakeLists.txt +++ b/universal/CMakeLists.txt @@ -73,6 +73,9 @@ userver_target_cxx_compile_options_if_supported( "-Wlogical-op" "-Wformat=2" "-Wno-error=deprecated-declarations" + # protobuf 6 generated code uses absl_nullable/absl_nonnull (-> _Nullable/_Nonnull), + # which are clang extensions and trip -Wpedantic -Werror in Debug builds. + "-Wno-nullability-extension" # This warning is unavoidable in generic code with templates "-Wno-useless-cast" # gcc complains: the ABI of passing union with ‘long double’ has changed in GCC 4.4 diff --git a/version.txt b/version.txt index f0d55097e0e0..9f55b2ccb5f2 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -3.1-rc +3.0