Compare commits

...

3 Commits

Author SHA1 Message Date
Pratik Mankawde
6bc3070856 activate tsan and asan for gcc and clang
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
2026-02-19 15:25:38 +00:00
Pratik Mankawde
21a52226bf Merge branch 'develop' into pratik/use_boost_coroutine2
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
2026-02-19 15:23:11 +00:00
Pratik Mankawde
7def28c8ef switch to ucontext and coroutine2
Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

updated conan profiles

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

removed no-pie

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

minor change

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

fixes for boost flags

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

minor fix

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

added boost flags to cxx_flags

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

added boost context to conanfile

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

added dependency to coroutine2

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

now building coroutine2

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

using without_coroutine2=false as well

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>

fix build

Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>
2025-11-21 12:11:13 +00:00
8 changed files with 47 additions and 22 deletions

View File

@@ -236,10 +236,12 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
# names get truncated.
# Add Address and Thread (both coupled with UB) sanitizers for specific bookworm distros.
# GCC-Asan rippled-embedded tests are failing because of https://github.com/google/sanitizers/issues/856
if (
os["distro_version"] == "bookworm"
and f"{os['compiler_name']}-{os['compiler_version']}" == "clang-20"
):
if os[
"distro_version"
] == "bookworm" and f"{os['compiler_name']}-{os['compiler_version']}" in [
"clang-20",
"gcc-15",
]:
# Add ASAN + UBSAN configuration.
configurations.append(
{
@@ -254,7 +256,7 @@ def generate_strategy_matrix(all: bool, config: Config) -> list:
}
)
# TSAN is deactivated due to seg faults with latest compilers.
activate_tsan = False
activate_tsan = True
if activate_tsan:
configurations.append(
{

View File

@@ -17,7 +17,7 @@ find_dependency(Boost
chrono
container
context
coroutine
coroutine2
date_time
filesystem
program_options

View File

@@ -4,7 +4,7 @@ include(XrplSanitizers)
find_package(Boost REQUIRED
COMPONENTS chrono
container
coroutine
context
date_time
filesystem
json
@@ -21,7 +21,7 @@ target_link_libraries(
INTERFACE Boost::headers
Boost::chrono
Boost::container
Boost::coroutine
Boost::context
Boost::date_time
Boost::filesystem
Boost::json

View File

@@ -13,15 +13,18 @@ include(default)
{% if "address" in sanitizers %}
{% set _ = sanitizer_list.append("address") %}
{% set model_code = "-mcmodel=large" %}
tools.build:defines+=["BOOST_USE_ASAN", "BOOST_USE_UCONTEXT"]
{% elif "thread" in sanitizers %}
{% set _ = sanitizer_list.append("thread") %}
{% set model_code = "-mcmodel=medium" %}
{% set _ = extra_cxxflags.append("-Wno-tsan") %}
tools.build:defines+=["BOOST_USE_TSAN", "BOOST_USE_UCONTEXT"]
{% endif %}
{% if "undefinedbehavior" in sanitizers %}
{% set _ = sanitizer_list.append("undefined") %}
{% set _ = sanitizer_list.append("float-divide-by-zero") %}
tools.build:defines+=["BOOST_USE_UBSAN", "BOOST_USE_UCONTEXT"]
{% endif %}
{% set sanitizer_flags = "-fsanitize=" ~ ",".join(sanitizer_list) ~ " " ~ model_code %}
@@ -37,14 +40,17 @@ include(default)
{% if "address" in sanitizers %}
{% set _ = sanitizer_list.append("address") %}
tools.build:defines+=["BOOST_USE_ASAN", "BOOST_USE_UCONTEXT"]
{% elif "thread" in sanitizers %}
{% set _ = sanitizer_list.append("thread") %}
tools.build:defines+=["BOOST_USE_TSAN", "BOOST_USE_UCONTEXT"]
{% endif %}
{% if "undefinedbehavior" in sanitizers %}
{% set _ = sanitizer_list.append("undefined") %}
{% set _ = sanitizer_list.append("float-divide-by-zero") %}
{% set _ = sanitizer_list.append("unsigned-integer-overflow") %}
tools.build:defines+=[ "BOOST_USE_UBSAN", "BOOST_USE_UCONTEXT"]
{% endif %}
{% set sanitizer_flags = "-fsanitize=" ~ ",".join(sanitizer_list) %}
@@ -56,4 +62,20 @@ include(default)
{% endif %}
{% endif %}
tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags"]
tools.info.package_id:confs+=["tools.build:cxxflags", "tools.build:exelinkflags", "tools.build:sharedlinkflags", "tools.build:defines"]
[options]
{% if compiler == "gcc" or compiler == "apple-clang" or compiler == "clang" %}
{% if sanitizers == "Address" or sanitizers == "Thread" %}
boost/*:without_context=False
boost/*:without_stacktrace=True
boost/*:without_coroutine2=False
{% if sanitizers == "Address" %}
boost/*:extra_b2_flags="context-impl=ucontext address-sanitizer=norecover undefined-sanitizer=norecover --with-coroutine2"
{% elif sanitizers == "Thread" %}
boost/*:extra_b2_flags="context-impl=ucontext thread-sanitizer=norecover undefined-sanitizer=norecover --with-coroutine2"
{% endif %}
{% endif %}
{% endif %}

View File

@@ -125,6 +125,7 @@ class Xrpl(ConanFile):
self.options["boost"].visibility = "global"
if self.settings.compiler in ["clang", "gcc"]:
self.options["boost"].without_cobalt = True
self.options["boost"].without_coroutine2 = False
def requirements(self):
# Conan 2 requires transitive headers to be specified
@@ -196,7 +197,8 @@ class Xrpl(ConanFile):
"boost::headers",
"boost::chrono",
"boost::container",
"boost::coroutine",
"boost::context",
"boost::coroutine2",
"boost::date_time",
"boost::filesystem",
"boost::json",

View File

@@ -173,6 +173,7 @@ words:
- nftpage
- nikb
- nonxrp
- norecover
- noripple
- nudb
- nullptr

View File

@@ -10,16 +10,14 @@ JobQueue::Coro::Coro(Coro_create_t, JobQueue& jq, JobType type, std::string cons
, type_(type)
, name_(name)
, running_(false)
, coro_(
[this, fn = std::forward<F>(f)](boost::coroutines::asymmetric_coroutine<void>::push_type& do_yield) {
yield_ = &do_yield;
yield();
fn(shared_from_this());
, coro_([this, fn = std::forward<F>(f)](boost::coroutines2::asymmetric_coroutine<void>::push_type& do_yield) {
yield_ = &do_yield;
yield();
fn(shared_from_this());
#ifndef NDEBUG
finished_ = true;
finished_ = true;
#endif
},
boost::coroutines::attributes(megabytes(1)))
})
{
}

View File

@@ -7,7 +7,7 @@
#include <xrpl/core/detail/Workers.h>
#include <xrpl/json/json_value.h>
#include <boost/coroutine/all.hpp>
#include <boost/coroutine2/all.hpp>
#include <set>
@@ -48,8 +48,8 @@ public:
std::mutex mutex_;
std::mutex mutex_run_;
std::condition_variable cv_;
boost::coroutines::asymmetric_coroutine<void>::pull_type coro_;
boost::coroutines::asymmetric_coroutine<void>::push_type* yield_;
boost::coroutines2::asymmetric_coroutine<void>::pull_type coro_;
boost::coroutines2::asymmetric_coroutine<void>::push_type* yield_;
#ifndef NDEBUG
bool finished_ = false;
#endif
@@ -326,7 +326,7 @@ private:
other requests while the RPC command completes its work asynchronously.
postCoro() creates a Coro object. When the Coro ctor is called, and its
coro_ member is initialized (a boost::coroutines::pull_type), execution
coro_ member is initialized (a boost::coroutines2::pull_type), execution
automatically passes to the coroutine, which we don't want at this point,
since we are still in the handler thread context. It's important to note
here that construction of a boost pull_type automatically passes execution to