medooze / media-server-demo-node

Demo application for the Medooze Media Server for Node.js
MIT License
92 stars 48 forks source link

node crashed #9

Closed laowangnj closed 6 years ago

laowangnj commented 6 years ago

when simulated about 40 peers to play a stream, this happen Error in `node': corrupted size vs. prev_size: 0x00000000025998d0 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fea5e0b17e5] /lib/x86_64-linux-gnu/libc.so.6(+0x7e9dc)[0x7fea5e0b89dc] /lib/x86_64-linux-gnu/libc.so.6(+0x81cde)[0x7fea5e0bbcde] /lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x54)[0x7fea5e0be184] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(_Znwm+0x18)[0x7fea5ebcde78]

murillo128 commented 6 years ago

would it be possible for you to share the code to reproduce the crash?

murillo128 commented 6 years ago

Also, please if you can pleas recompile in debug to get a cleaner trace:

on binding.gyp change

"cflags": 
    [
        "-fexceptions",
        "-std=c++11",
        "-O3",
        #"-g",
        #"-O0",
        #"-fsanitize=address"
    ],

by

"cflags": 
    [
        "-fexceptions",
        "-std=c++11",
        #"-O3",
        "-g",
        "-O0",
        "-fsanitize=address"
    ],

and recompile with npm run-script build

laowangnj commented 6 years ago

module.js:681 return process.dlopen(module, path._makeLong(filename)); ^

Error: /home/wang/workspace/media-server-remote/node_modules/medooze-media-server/build/Release/medooze-media-server.node: undefined symbol: __asan_option_detect_stack_use_after_return at Object.Module._extensions..node (module.js:681:18) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (/home/wang/workspace/media-server-remote/node_modules/medooze-media-server/lib/Native.js:10:19) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32)

laowangnj commented 6 years ago

and firefox joined to supply init stream。

------------------ Original ------------------ From: "Sergio Garcia Murillo"notifications@github.com; Date: Mon, Apr 16, 2018 05:30 PM To: "medooze/media-server-demo-node"media-server-demo-node@noreply.github.com; Cc: "J"njwxc@qq.com; "Author"author@noreply.github.com; Subject: Re: [medooze/media-server-demo-node] node crashed (#9)

would it be possible for you to share the code to reproduce the crash?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

murillo128 commented 6 years ago

comment out the "-fsanitize=address" option sorry

laowangnj commented 6 years ago

0 malloc_consolidate (av=av@entry=0x7f27a2954b20 ) at malloc.c:4169

1 0x00007f27a2611cde in _int_malloc (av=av@entry=0x7f27a2954b20 , bytes=bytes@entry=65536) at malloc.c:3450

2 0x00007f27a2614184 in __GI___libc_malloc (bytes=65536) at malloc.c:2913

3 0x00007f27a2614a18 in __GI___libc_realloc (oldmem=0x0, bytes=65536) at malloc.c:2994

4 0x000000000126bed9 in node::LibuvStreamWrap::OnAllocImpl(unsigned long, uv_buf_t, void) ()

5 0x000000000126bbbf in node::LibuvStreamWrap::OnAlloc(uv_handle_s, unsigned long, uv_buf_t) ()

6 0x0000000001416458 in ?? ()

7 0x0000000001416c40 in ?? ()

8 0x000000000141ca08 in ?? ()

9 0x000000000140b2d6 in uv_run ()

10 0x00000000011f933d in node::Start(uv_loop_s, int, char const const, int, char const const*) ()

11 0x00000000011f1c0d in node::Start(int, char**) ()

12 0x00007f27a25b0830 in __libc_start_main (main=0x897bb0
, argc=2, argv=0x7ffd80bb22f8, init=, fini=, rtld_fini=,

stack_end=0x7ffd80bb22e8) at ../csu/libc-start.c:291

13 0x0000000000899ae1 in _start ()

------------------ Original ------------------ From: "Sergio Garcia Murillo"notifications@github.com; Date: Mon, Apr 16, 2018 06:15 PM To: "medooze/media-server-demo-node"media-server-demo-node@noreply.github.com; Cc: "J"njwxc@qq.com; "Author"author@noreply.github.com; Subject: Re: [medooze/media-server-demo-node] node crashed (#9)

comment out the "-fsanitize=address" option sorry

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

murillo128 commented 6 years ago

Please, check the latest version to see if it solves the problem (and open the issue again if not)

Thank you!

laowangnj commented 6 years ago

v0.26.5 stay the same. v0.27.x runs error

murillo128 commented 6 years ago

please check latest v.0.29.1

laowangnj commented 6 years ago

v0.29.1 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `node index.js'. Program terminated with signal SIGSEGV, Segmentation fault.

0 malloc_consolidate (av=av@entry=0x7fca113e3b20 ) at malloc.c:4169

4169 malloc.c: No such file or directory. [Current thread is 1 (Thread 0x7fc9ceff5700 (LWP 21541))] (gdb) bt

0 malloc_consolidate (av=av@entry=0x7fca113e3b20 ) at malloc.c:4169

1 0x00007fca110a0cde in _int_malloc (av=av@entry=0x7fca113e3b20 , bytes=bytes@entry=2136) at malloc.c:3450

2 0x00007fca110a3258 in __GI___libc_malloc (bytes=2136) at malloc.c:2913

3 0x00007fca11bb2e78 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6

4 0x00007fca0e8ca7c8 in gnu_cxx::new_allocator::allocate (this=, n=1) at /usr/include/c++/5/ext/new_allocator.h:104

5 std::allocator_traits<std::allocator >::allocate (a=..., n=1) at /usr/include/c++/5/bits/alloc_traits.h:491

6 std::__allocate_guarded<std::allocator > (__a=...) at /usr/include/c++/5/bits/allocated_ptr.h:102

7 std::shared_ptr<RTPPacket, (__gnu_cxx::_Lock_policy)2>::shared_ptr<std::allocator, MediaFrame::Type, unsigned char, RTPHeader&, RTPHeaderExtension&>(std::_Sp_make_shared_tag, std::allocator const&, MediaFrame::Type&&, unsigned char&&, RTPHeader&, RTPHeaderExtension&) (a=..., tag=...,

this=<synthetic pointer>) at /usr/include/c++/5/bits/shared_ptr_base.h:1125

8 std::shared_ptr::shared_ptr<std::allocator, MediaFrame::Type, unsigned char, RTPHeader&, RTPHeaderExtension&>(std::_Sp_make_shared_tag, std::allocator const&, MediaFrame::Type&&, unsigned char&&, RTPHeader&, RTPHeaderExtension&) (a=..., tag=..., this=)

at /usr/include/c++/5/bits/shared_ptr.h:319

9 std::allocate_shared<RTPPacket, std::allocator, MediaFrame::Type, unsigned char, RTPHeader&, RTPHeaderExtension&>(std::allocator const&, MediaFrame::Type&&, unsigned char&&, RTPHeader&, RTPHeaderExtension&) (__a=...) at /usr/include/c++/5/bits/shared_ptr.h:620

10 std::make_shared<RTPPacket, MediaFrame::Type, unsigned char, RTPHeader&, RTPHeaderExtension&>(MediaFrame::Type&&, unsigned char&&, RTPHeader&, RTPHeaderExtension&) ()

at /usr/include/c++/5/bits/shared_ptr.h:636

11 DTLSICETransport::Send (this=0x3b841f0, packet=std::shared_ptr (count 1, weak 0) 0x7fc9e40064e0) at ../media-server/src/DTLSICETransport.cpp:1456

12 0x00007fca0e8fe6b8 in RTPStreamTransponder::Run (this=this@entry=0x3b972f0) at ../media-server/src/rtp/RTPStreamTransponder.cpp:347

13 0x00007fca0e8fe9c5 in RTPStreamTransponder::run (par=0x3b972f0) at ../media-server/src/rtp/RTPStreamTransponder.cpp:280

14 0x00007fca113f06ba in start_thread (arg=0x7fc9ceff5700) at pthread_create.c:333

15 0x00007fca1112641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

murillo128 commented 6 years ago

I assume that you can open the core with gdb, right?

Can you go up to #11 (DTLSICETransport.cpp:1456) and print the value of packet, header and extension?


auto rtx = std::make_shared<RTPPacket>(packet->GetMedia(),packet->GetCodec(),header,extension);
murillo128 commented 6 years ago

Also, could you provide a bit more context on how are able to generate the crash? OS,which demo are you using, etc..

laowangnj commented 6 years ago

Ubuntu 16.04.4 LTS. the simulcast demo as server, a firefox browser provides input stream, and another server acts as tens of clients to receive the same stream.

murillo128 commented 6 years ago

How are you sending the simulcast stream to the othere server? can you share your code?

laowangnj commented 6 years ago

how to act as clients #8

murillo128 commented 6 years ago

Can you try again with latest code (both demo and media server)?

I have been doing a major rewrite on the affected code, so it may have solved it.

laowangnj commented 6 years ago

v0.29.3 the same. 30 clients:not crash at clients startup, 40 clients crashed

murillo128 commented 6 years ago

I don't see where do you send or receive any actual data from the client or server (except the commented out player)

Could you upload your code to a couple of temporal github repos so I can test exactly the same as you?

laowangnj commented 6 years ago

open a browser to supply the first stream for the room

laowangnj commented 6 years ago

https://github.com/laowangnj/tmpdata.git

murillo128 commented 6 years ago

Thanxs! the good news are that I am able to reproduce the issue.. :)

laowangnj commented 6 years ago

👍

murillo128 commented 6 years ago

I am no longer able to reproduce it after the fix. Could you confirm it also solves the seg fault on your side?

Thank you for the report and the support for troubleshooting it!