-
Notifications
You must be signed in to change notification settings - Fork 24
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
linux运行wsserver出现段错误 #1
Comments
websocket这块我只做了简单的实现,并未检查内存泄露情况,你可以自己修改这块。该工程只是我用来验证自己的设想,并非用于工作环境。你可以自己重构下websocket这部分
发自我的iPhone
… 在 2021年5月14日,下午10:29,Gary Taiji Gao ***@***.***> 写道:
感谢作者的辛苦贡献,本人在centos7服务器运行一段时间后,wsserver会出现段错误导致服务崩溃,调试coredump文件见下面日志,疑似buf的内容和buflen长度不一致,还请作者解惑,不胜感激。
Core was generated by `./WSServer 9001'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000021 in ?? ()
(gdb) bt
#0 0x0000000000000021 in ?? ()
#1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
#2 0x00000000006a0141 in boost::_mfi::mf0<void, RtspSource>::operator() (this=0x7fe109c96848, p=0x55fb000) at /usr/include/boost/bind/mem_fn_template.hpp:49
#3 0x00000000006a00a4 in boost::_bi::list1<boost::_bi::value<RtspSource*> >::operator()<boost::_mfi::mf0<void, RtspSource>, boost::_bi::list0> (this=0x7fe109c96858, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:253
#4 0x000000000069fe47 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > >::operator() (this=0x7fe109c96848)
at /usr/include/boost/bind/bind_template.hpp:20
#5 0x000000000069fb76 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > > >::run (this=0x7fe109c96690)
at /usr/include/boost/thread/detail/thread.hpp:117
#6 0x00007fe3c0ae425a in boost::(anonymous namespace)::thread_proxy (param=) at libs/thread/src/pthread/thread.cpp:165
#7 0x00007fe3bfc88ea5 in start_thread (arg=0x7fe3bdea7700) at pthread_create.c:307
#8 0x00007fe3bf9b19fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) f 1
#1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
warning: Source file is more recent than executable.
422 delete fdata;
(gdb) p fdata->buf
$1 = (uint8_t *) 0x7fe23c000088 "\360^\325\032\341\177"
(gdb) p fdata->buflen
$2 = 32
(gdb)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
如果要把这个程序作为服务,应该要把rtsp数据做个缓冲,并且在每次发送ws数据时检查实际发出的数据长度,这个处理我是没做的,问题可能出在这里,我的程序是一个验证,因此并未考虑带宽问题,也就是实际发出数据长度问题,ws这块也可能有内存泄露,因为我只是随便找了个ws库做了个简单的发送处理
发自我的iPhone
… 在 2021年5月14日,下午10:43,杨旋 ***@***.***> 写道:
websocket这块我只做了简单的实现,并未检查内存泄露情况,你可以自己修改这块。该工程只是我用来验证自己的设想,并非用于工作环境。你可以自己重构下websocket这部分
发自我的iPhone
>> 在 2021年5月14日,下午10:29,Gary Taiji Gao ***@***.***> 写道:
>>
>
> 感谢作者的辛苦贡献,本人在centos7服务器运行一段时间后,wsserver会出现段错误导致服务崩溃,调试coredump文件见下面日志,疑似buf的内容和buflen长度不一致,还请作者解惑,不胜感激。
> Core was generated by `./WSServer 9001'.
> Program terminated with signal 11, Segmentation fault.
> #0 0x0000000000000021 in ?? ()
> (gdb) bt
> #0 0x0000000000000021 in ?? ()
> #1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
> #2 0x00000000006a0141 in boost::_mfi::mf0<void, RtspSource>::operator() (this=0x7fe109c96848, p=0x55fb000) at /usr/include/boost/bind/mem_fn_template.hpp:49
> #3 0x00000000006a00a4 in boost::_bi::list1<boost::_bi::value<RtspSource*> >::operator()<boost::_mfi::mf0<void, RtspSource>, boost::_bi::list0> (this=0x7fe109c96858, f=..., a=...)
> at /usr/include/boost/bind/bind.hpp:253
> #4 0x000000000069fe47 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > >::operator() (this=0x7fe109c96848)
> at /usr/include/boost/bind/bind_template.hpp:20
> #5 0x000000000069fb76 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > > >::run (this=0x7fe109c96690)
> at /usr/include/boost/thread/detail/thread.hpp:117
> #6 0x00007fe3c0ae425a in boost::(anonymous namespace)::thread_proxy (param=) at libs/thread/src/pthread/thread.cpp:165
> #7 0x00007fe3bfc88ea5 in start_thread (arg=0x7fe3bdea7700) at pthread_create.c:307
> #8 0x00007fe3bf9b19fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
> (gdb) f 1
> #1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
> warning: Source file is more recent than executable.
> 422 delete fdata;
> (gdb) p fdata->buf
> $1 = (uint8_t *) 0x7fe23c000088 "\360^\325\032\341\177"
> (gdb) p fdata->buflen
> $2 = 32
> (gdb)
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub, or unsubscribe.
|
感谢答复,这个问题不是内存泄露,即使websocket没有完全发送成功,av_fifo_generic_read这个函数已经完全读出了rtsp拉流数据,delete pdata理论上是与websocket发送多少字节没有关系的,所以不理解为何delete pdata销毁内存有时会越界。因个人对buf内的音视频数据不太熟悉,不清楚buf的内存数据是否与实际的buflen一致,作者如果方便可加下微信13862049340,进一步深入讨论,谢谢 |
视频缓冲这里应该是没有问题的,我对ws不是太熟,所以推断问题可能出在这里,以前也有人反应过这个程序有内存泄露的情况,因为这个程序我只是验证我的思路,并不用在生产环境,所以就一直没有去排查。ffmpeg部分我是经常这么写的,应该没有什么问题
发自我的iPhone
… 在 2021年5月15日,下午11:28,Gary Taiji Gao ***@***.***> 写道:
感谢答复,这个问题不是内存泄露,即使websocket没有完全发送成功,av_fifo_generic_read这个函数已经完全读出了rtsp拉流数据,delete pdata理论上是与websocket发送多少字节没有关系的,所以不理解为何delete pdata销毁内存有时会越界。因个人对buf内的音视频数据不太熟悉,不清楚buf的内存数据是否与实际的buflen一致,作者如果方便可加下微信13862049340,进一步深入讨论,谢谢
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
感谢作者的辛苦贡献,本人在centos7服务器运行一段时间后,wsserver会出现段错误导致服务崩溃,调试coredump文件见下面日志,疑似buf的内容和buflen长度不一致,还请作者解惑,不胜感激。
Core was generated by `./WSServer 9001'.
Program terminated with signal 11, Segmentation fault.
#0 0x0000000000000021 in ?? ()
(gdb) bt
#0 0x0000000000000021 in ?? ()
#1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
#2 0x00000000006a0141 in boost::_mfi::mf0<void, RtspSource>::operator() (this=0x7fe109c96848, p=0x55fb000) at /usr/include/boost/bind/mem_fn_template.hpp:49
#3 0x00000000006a00a4 in boost::_bi::list1<boost::_bi::value<RtspSource*> >::operator()<boost::_mfi::mf0<void, RtspSource>, boost::_bi::list0> (this=0x7fe109c96858, f=..., a=...)
at /usr/include/boost/bind/bind.hpp:253
#4 0x000000000069fe47 in boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > >::operator() (this=0x7fe109c96848)
at /usr/include/boost/bind/bind_template.hpp:20
#5 0x000000000069fb76 in boost::detail::thread_data<boost::_bi::bind_t<void, boost::_mfi::mf0<void, RtspSource>, boost::_bi::list1<boost::_bi::value<RtspSource*> > > >::run (this=0x7fe109c96690)
at /usr/include/boost/thread/detail/thread.hpp:117
#6 0x00007fe3c0ae425a in boost::(anonymous namespace)::thread_proxy (param=) at libs/thread/src/pthread/thread.cpp:165
#7 0x00007fe3bfc88ea5 in start_thread (arg=0x7fe3bdea7700) at pthread_create.c:307
#8 0x00007fe3bf9b19fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
(gdb) f 1
#1 0x000000000069a3b5 in RtspSource::SendWSData (this=0x55fb000) at RtspSource.cpp:422
warning: Source file is more recent than executable.
422 delete fdata;
(gdb) p fdata->buf
$1 = (uint8_t *) 0x7fe23c000088 "\360^\325\032\341\177"
(gdb) p fdata->buflen
$2 = 32
(gdb)
The text was updated successfully, but these errors were encountered: