Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Run worker tests with Address Sanitizer (only Linux) #1416

Merged
merged 12 commits into from
Jul 1, 2024

Conversation

ibc
Copy link
Member

@ibc ibc commented Jun 28, 2024

Details

  • Also run worker tests with Address Sanitizer (only Linux).
  • Split test-asan into test-asan-address, test-asan-undefined and test-asan-thread.
  • Remove --use-colour=yes (no longer supported looks like) when running mediasoup-worker-test-asan executable.

Bonus Tracks

  • Update liburing.wrap to 2.5-1.
  • Update catch2.wrap to 3.6.0-1.

Related PRs this PR replaces

### Details

- Also run worker tests with Address Sanitizer (only Linux).

### TODO

- CI fails because indeed we have problems, see comments below.
@ibc ibc marked this pull request as draft June 28, 2024 12:05
@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 1 (FIXED)

(Fixed in ad3817c)

When running (in Linux Docker) invoke test-asan-address:

cd "/mediasoup/worker" && ASAN_OPTIONS=detect_leaks=1 "/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address" --invisibles
AddressSanitizer:DEADLYSIGNAL
=================================================================
==5092==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0xaaaab187ab30 bp 0xffffdb3cf5d0 sp 0xffffdb3cf5d0 T0)
==5092==The signal is caused by a READ memory access.
==5092==Hint: address points to the zero page.
    #0 0xaaaab187ab30 in void absl::lts_20230802::container_internal::InitializeSlots<std::allocator<char>, 40ul, 8ul>(absl::lts_20230802::container_internal::CommonFields&, std::allocator<char>) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x21ab30) (BuildId: 6b9fcd5d12bc7c25c379f76e7292ff0692fe990c)
    #1 0xaaaab188d448 in absl::lts_20230802::container_internal::raw_hash_set<absl::lts_20230802::container_internal::FlatHashMapPolicy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, LogLevel>, absl::lts_20230802::container_internal::StringHash, absl::lts_20230802::container_internal::StringEq, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, LogLevel> > >::raw_hash_set(unsigned long, absl::lts_20230802::container_internal::StringHash const&, absl::lts_20230802::container_internal::StringEq const&, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, LogLevel> > const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x22d448) (BuildId: 6b9fcd5d12bc7c25c379f76e7292ff0692fe990c)
    #2 0xaaaab188d030 in absl::lts_20230802::container_internal::raw_hash_set<absl::lts_20230802::container_internal::FlatHashMapPolicy<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, LogLevel>, absl::lts_20230802::container_internal::StringHash, absl::lts_20230802::container_internal::StringEq, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, LogLevel> > >::raw_hash_set(std::initializer_list<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, LogLevel> >, unsigned long, absl::lts_20230802::container_internal::StringHash const&, absl::lts_20230802::container_internal::StringEq const&, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, LogLevel> > const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x22d030) (BuildId: 6b9fcd5d12bc7c25c379f76e7292ff0692fe990c)
    #3 0xaaaab17b1408 in _GLOBAL__sub_I_Settings.cpp Settings.cpp
    #4 0xffffa43a7548 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x27548) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #5 0xaaaab17c7fec in _start (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x167fec) (BuildId: 6b9fcd5d12bc7c25c379f76e7292ff0692fe990c)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x21ab30) (BuildId: 6b9fcd5d12bc7c25c379f76e7292ff0692fe990c) in void absl::lts_20230802::container_internal::InitializeSlots<std::allocator<char>, 40ul, 8ul>(absl::lts_20230802::container_internal::CommonFields&, std::allocator<char>)
==5092==ABORTING

@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 2

When running (in Linux Docker) invoke test-asan-undefined:

cd "/mediasoup/worker" && ASAN_OPTIONS=detect_leaks=1 "/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-undefined" --invisibles
Randomness seeded to: 3112908262
../../../include/RTC/RtpPacket.hpp:131:14: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:131:14 in
../../../src/RTC/RtpPacket.cpp:35:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:35:15 in
../../../src/RTC/RtpPacket.cpp:53:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:53:15 in
../../../src/RTC/RtpPacket.cpp:88:15: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:88:15 in
../../../src/RTC/RtpPacket.cpp:142:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RtpPacket.cpp:142:21 in
../../../include/RTC/RtpPacket.hpp:175:25: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:175:25 in
../../../include/RTC/RtpPacket.hpp:165:25: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:165:25 in
../../../include/RTC/RtpPacket.hpp:190:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:190:21 in
../../../include/RTC/RtpPacket.hpp:200:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:200:21 in
../../../include/RTC/RtpPacket.hpp:200:21: runtime error: load of misaligned address 0xaaaab13273aa for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0xaaaab13273aa: note: pointer points here
 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:200:21 in
../../../include/RTC/RtpPacket.hpp:210:21: runtime error: member access within misaligned address 0xaaaab13273a6 for type 'RTC::RtpPacket::Header', which requires 4 byte alignment
0xaaaab13273a6: note: pointer points here
 30 30 00 00 90 6f  5c 41 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:210:21 in
../../../include/RTC/RtpPacket.hpp:210:21: runtime error: load of misaligned address 0xaaaab13273ae for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0xaaaab13273ae: note: pointer points here
 62 f5 47 da 9f 71  08 e2 be de 00 01 10 a0  00 00 67 42 e0 0d 9a 00  00 00 00 00 00 00 00 00  00 00
             ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../include/RTC/RtpPacket.hpp:210:21 in
../../../src/RTC/RTCP/Packet.cpp:220:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:220:18 in
../../../src/RTC/RTCP/Packet.cpp:221:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:221:18 in
../../../src/RTC/RTCP/Packet.cpp:222:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 80 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:222:18 in
../../../src/RTC/RTCP/Packet.cpp:223:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 81 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:223:18 in
../../../src/RTC/RTCP/Packet.cpp:224:18: runtime error: member access within misaligned address 0xaaaab1307201 for type 'RTC::RTCP::Packet::CommonHeader', which requires 2 byte alignment
0xaaaab1307201: note: pointer points here
 00 00 00  00 81 cd 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:224:18 in
../../../src/RTC/RTCP/Packet.cpp:224:18: runtime error: store to misaligned address 0xaaaab1307203 for type 'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
0xaaaab1307203: note: pointer points here
 00  00 81 cd 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../../src/RTC/RTCP/Packet.cpp:224:18 in
===============================================================================
All tests passed (592743 assertions in 47 test cases)

@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

TODO 3

Should we also enable -sanitize='leak' (well, probably included in -satinize=address,leak? Or should ASAN_OPTIONS=detect_leaks=1 already enable it?

NOTE: If I only run -sanitize='leak' I get these errors:

==6700==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 240 byte(s) in 1 object(s) allocated from:
    #0 0xaaaabc54c830 in operator new(unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1fc830) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #1 0xaaaabc5b24f8 in RTC::RtpPacket::Parse(unsigned char const*, unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2624f8) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #2 0xaaaabc65a240 in RtpMyRetransmissionBuffer::Insert(unsigned short, unsigned int) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x30a240) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #3 0xaaaabc659914 in CATCH2_INTERNAL_TEST_0() TestRtpRetransmissionBuffer.cpp
    #4 0xaaaabc942440 in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f2440) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #5 0xaaaabc941ef0 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f1ef0) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #6 0xaaaabc94d7fc in Catch::Session::runInternal() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fd7fc) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #7 0xaaaabc94cf80 in Catch::Session::run() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fcf80) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #8 0xaaaabc633750 in main (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2e3750) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #9 0xffffb27c73f8  (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #10 0xffffb27c74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #11 0xaaaabc522b6c in _start (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1d2b6c) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)

Direct leak of 240 byte(s) in 1 object(s) allocated from:
    #0 0xaaaabc54c830 in operator new(unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1fc830) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #1 0xaaaabc5b24f8 in RTC::RtpPacket::Parse(unsigned char const*, unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2624f8) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #2 0xaaaabc65a8d0 in CATCH2_INTERNAL_TEST_0() TestRtpStreamSend.cpp
    #3 0xaaaabc942440 in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f2440) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #4 0xaaaabc941ef0 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f1ef0) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #5 0xaaaabc94d7fc in Catch::Session::runInternal() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fd7fc) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #6 0xaaaabc94cf80 in Catch::Session::run() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fcf80) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #7 0xaaaabc633750 in main (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2e3750) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #8 0xffffb27c73f8  (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #9 0xffffb27c74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #10 0xaaaabc522b6c in _start (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1d2b6c) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)

Direct leak of 240 byte(s) in 1 object(s) allocated from:
    #0 0xaaaabc54c830 in operator new(unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1fc830) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #1 0xaaaabc5b24f8 in RTC::RtpPacket::Parse(unsigned char const*, unsigned long) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2624f8) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #2 0xaaaabc65a240 in RtpMyRetransmissionBuffer::Insert(unsigned short, unsigned int) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x30a240) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #3 0xaaaabc659d1c in CATCH2_INTERNAL_TEST_0() TestRtpRetransmissionBuffer.cpp
    #4 0xaaaabc942440 in Catch::RunContext::runCurrentTest(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f2440) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #5 0xaaaabc941ef0 in Catch::RunContext::runTest(Catch::TestCaseHandle const&) (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5f1ef0) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #6 0xaaaabc94d7fc in Catch::Session::runInternal() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fd7fc) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #7 0xaaaabc94cf80 in Catch::Session::run() (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x5fcf80) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #8 0xaaaabc633750 in main (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x2e3750) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)
    #9 0xffffb27c73f8  (/lib/aarch64-linux-gnu/libc.so.6+0x273f8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #10 0xffffb27c74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8) (BuildId: aa6e122fa39ae02d412afb49d75e33281fcd2805)
    #11 0xaaaabc522b6c in _start (/mediasoup/worker/out/Release/build/mediasoup-worker-test-asan-address+0x1d2b6c) (BuildId: a69bc907dbee65a7a73448abb135fae032af704a)

// many more

@jmillan
Copy link
Member

jmillan commented Jul 1, 2024

TODO1

We must add asan options to dependencies too. By adding the following lines to meson.build we are doing so. We need to apply this only when running asan, so we may need a new meson option (meson_options.txt) ie: enable_asan_xyz:

diff --git a/worker/meson.build b/worker/meson.build
index 6c94280d9..75489b6cc 100644
--- a/worker/meson.build
+++ b/worker/meson.build
@@ -13,6 +13,9 @@ cpp_args = [
   host_machine.endian() == 'little' ? '-DMS_LITTLE_ENDIAN' : '-DMS_BIG_ENDIAN',
 ]

+add_global_arguments('-fsanitize=address', language: 'cpp')
+add_global_link_arguments('-fsanitize=address', language: 'cpp')
+

By adding that patch the TODO1 error does not appear. A new one is present though, but anyway abseil must be also given those compile and link options.

@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

By adding that patch the TODO1 error does not appear. A new one is present though, but anyway abseil must be also given those compile and link options.

Isn't this better? In tasks.py:

-@task(pre=[setup, flatc])
+@task(pre=[call(setup, meson_args=MESON_ARGS + ' -Db_sanitize=address'), flatc])
 def test_asan_address(ctx):
     """
     Run worker test with Address Sanitizer with '-fsanitize=address'

@ibc ibc mentioned this pull request Jul 1, 2024
@ibc ibc marked this pull request as ready for review July 1, 2024 11:54
@ibc
Copy link
Member Author

ibc commented Jul 1, 2024

We will fix ASAN issues in a separate tickets. This PR has disabled those CI tasks until they are fixed.

So let's continue fixing ASAN things in here: #1417

@ibc ibc merged commit 73be1dd into v3 Jul 1, 2024
41 checks passed
@ibc ibc deleted the run-worker-test-with-address-sanitizer branch July 1, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants