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

Catch v2.0.1: TestRtpStreamRecv.cpp: SIGSEGV #173

Closed
ibc opened this issue Dec 1, 2017 · 10 comments
Closed

Catch v2.0.1: TestRtpStreamRecv.cpp: SIGSEGV #173

ibc opened this issue Dec 1, 2017 · 10 comments
Labels

Comments

@ibc
Copy link
Member

ibc commented Dec 1, 2017

It happens in OSX. It does NOT happen in Linux.

../test/RTC/TestRtpStreamRecv.cpp:117: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal

The core dump:

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       EXC_I386_GPFLT
Exception Note:        EXC_CORPSE_NOTIFY

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   mediasoup-worker-test               0x00000001014ec404 RTC::NackGenerator::GetNackBatch(RTC::NackGenerator::NackFilter) + 732 (NackGenerator.cpp:212)
1   mediasoup-worker-test               0x00000001014ea6a7 RTC::NackGenerator::ReceivePacket(RTC::RtpPacket*) + 1825
2   mediasoup-worker-test               0x00000001015dac02 RTC::RtpStreamRecv::ReceivePacket(RTC::RtpPacket*) + 354 (RtpStreamRecv.cpp:71)
3   mediasoup-worker-test               0x0000000101a24d6c ____C_A_T_C_H____T_E_S_T____0() + 14604 (TestRtpStreamRecv.cpp:130)
4   mediasoup-worker-test               0x000000010183ea41 Catch::RunContext::invokeActiveTestCase() + 115 (catch.hpp:7955)
5   mediasoup-worker-test               0x000000010183985b Catch::RunContext::runCurrentTest(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&) + 1179 (catch.hpp:7926)
6   mediasoup-worker-test               0x0000000101837675 Catch::RunContext::runTest(Catch::TestCase const&) + 1493 (catch.hpp:7722)
7   mediasoup-worker-test               0x0000000101844e40 Catch::Session::runInternal() + 9382 (catch.hpp:8162)
8   mediasoup-worker-test               0x00000001018427f2 Catch::Session::run() + 382 (catch.hpp:8306)
9   mediasoup-worker-test               0x0000000101842661 Catch::Session::run(int, char**) + 99 (catch.hpp:8272)
10  mediasoup-worker-test               0x0000000101874085 main + 425 (tests.cpp:26)
11  libdyld.dylib                       0x00007fff6de3e145 start + 1

It points to this line:

uint16_t seq       = nackInfo.seq;

so it seems that nackInfo was not what it was supposed to be...

@ibc ibc added the bug label Dec 1, 2017
@ibc ibc added this to the v2 updates milestone Dec 1, 2017
@ibc
Copy link
Member Author

ibc commented Dec 1, 2017

NOTE: I've upgraded libuv to 1.18.0 and Catch to 2.0.1, but I don't think this is related at all:

https://github.com/catchorg/Catch2/releases

@ibc
Copy link
Member Author

ibc commented Dec 1, 2017

Opss! it does not fail with Catch 1.9.7 (the version until today) neither it fails with 1.11.0 (the latest 1.X release), so it's definitely related to some change in Catch v2.0.1 (that just happens in OSX!).

Here the list of breaking changes:

https://github.com/catchorg/Catch2/releases/tag/v2.0.1

NOTE: Downgrading to 1.11.0 until we discover the problem.

@ibc ibc changed the title TestRtpStreamRecv.cpp: SIGSEGV Catch v2.1.0: TestRtpStreamRecv.cpp: SIGSEGV Dec 1, 2017
ibc added a commit that referenced this issue Dec 1, 2017
@ibc ibc changed the title Catch v2.1.0: TestRtpStreamRecv.cpp: SIGSEGV Catch v2.0.1: TestRtpStreamRecv.cpp: SIGSEGV Dec 1, 2017
@ibc
Copy link
Member Author

ibc commented Dec 1, 2017

It's very interesting that, in OSX with Catch 2.0.1, just the following tests fail:

  • TestRtpStreamRecv.cpp - SECTION("require key frame"):
-------------------------------------------------------------------------------
Scenario: receive RTP packets and trigger NACK
  require key frame
-------------------------------------------------------------------------------
../test/RTC/TestRtpStreamRecv.cpp:117
...............................................................................

../test/RTC/TestRtpStreamRecv.cpp:117: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGSEGV - Segmentation violation signal
  • TestVP8.cpp - SCENARIO("parse VP8 payload descriptor", "[codecs][vp8]"):
-------------------------------------------------------------------------------
Scenario: parse VP8 payload descriptor
  parse payload descriptor
-------------------------------------------------------------------------------
../test/RTC/Codecs/TestVP8.cpp:10
...............................................................................

../test/RTC/Codecs/TestVP8.cpp:61: FAILED:
  REQUIRE( payloadDescriptor->isKeyFrame == true )
with expansion:
  false == true

@ibc
Copy link
Member Author

ibc commented Dec 1, 2017

Opss, in TestVP8.cpp, if I rename originalBuffer to anything else, it does NOT fail!!!

So I think this is the same error we already had: variables are shared across all the tests, specially in OSX. Well, not exactly, here the problem is that originalBuffer is defined twice in the same TestVP8.cpp within two different sections.

NOTE: I was not able to make the TestRtpStreamRecv failing test work with any hack as variable renaming, so no idea here...

@ibc
Copy link
Member Author

ibc commented Dec 1, 2017

Reported in Catch: catchorg/Catch2#1118

@lightmare
Copy link

../test/RTC/Codecs/TestVP8.cpp:61: FAILED:
  REQUIRE( payloadDescriptor->isKeyFrame == true )
with expansion:
  false == true

Before worker/src/RTC/Codecs/VP8.cpp#L96, offset was incremented twice (X and I bits are set), so this line reads data[3], which is beyond the buffer.

@ibc
Copy link
Member Author

ibc commented Dec 5, 2017

Oh, thanks @lightmare, will check it.

@jmillan
Copy link
Member

jmillan commented Dec 15, 2017

The TestVP8.cpp issue has been fixed. As @lightmare commented it was accessing a position of the buffer that was not initialised.

@lightmare
Copy link

Well that fixed the test sample, but the function VP8::Parse needs fixing as well. When you call Parse(buf, 3) it must not read buf[3].

@jmillan
Copy link
Member

jmillan commented Dec 15, 2017

You're right. Fixed in ed28b24. Thanks @lightmare.

@ibc ibc modified the milestones: v2 updates, Future Nov 29, 2018
@ibc ibc closed this as completed in e6272ee Dec 4, 2018
lavarsicious pushed a commit to lavarsicious/mediasoup that referenced this issue Feb 5, 2019
@ibc ibc removed this from the Future milestone May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants