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

用libhv做tts请求的时候,发生crash错误。 #665

Open
qZhang88 opened this issue Jan 6, 2025 · 3 comments
Open

用libhv做tts请求的时候,发生crash错误。 #665

qZhang88 opened this issue Jan 6, 2025 · 3 comments

Comments

@qZhang88
Copy link

qZhang88 commented Jan 6, 2025

日志和crushdump信息。

[ INFO] [1736047420.279502510]: [voice] websocket open
[ WARN] [1736047420.512266257]: [voice] [parse_response] Error message code: 3010
[ INFO] [1736047420.512841844]: [voice] websocket close
[ WARN] [1736047420.513681225]: [voice] [parse_response] Error message code: 3010

Obtained 36 stacks.
/opt/x/lib/voice/voice(_Z10crash_dumpi+0x30) [0x558482d37c]
linux-vdso.so.1(__kernel_rt_sigreturn+0) [0x7f923e6770]
/opt/x/lib/voice/voice(_ZZN12SDK3ttsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_ENKUlS7_E0_clES7_+0x3c) [0x558484a378]
/opt/x/lib/voice/voice(_ZNSt17_Function_handlerIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEZN12SDK3ttsES7_S7_EUlS7_E0_E9_M_invokeERKSt9_Any_dataS7_+0x34) [0x5584878aa0]
/opt/x/lib/voice/voice(_ZNKSt8functionIFvRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEclES7_+0x4c) [0x55848fac18]
/opt/x/lib/voice/voice(+0x35a310) [0x55848f5310]
/opt/x/lib/voice/voice(+0x35bbfc) [0x55848f6bfc]
/opt/x/lib/voice/voice(_ZNKSt8functionIFviRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEEclEiS7_+0x64) [0x558491b1fc]
/opt/x/lib/voice/voice(+0x380034) [0x558491b034]
/opt/x/lib/voice/voice(websocket_parser_execute+0x848) [0x5584928af4]
/opt/x/lib/voice/voice(_ZN15WebSocketParser12FeedRecvDataEPKcm+0x34) [0x558491b168]
/opt/x/lib/voice/voice(+0x35ab84) [0x55848f5b84]
/opt/x/lib/voice/voice(+0x35befc) [0x55848f6efc]
/opt/x/lib/voice/voice(_ZNKSt8functionIFvRKSt10shared_ptrIN2hv16WebSocketChannelEEP4HBufEEclES5_S7_+0x64) [0x55848ff248]
/opt/x/lib/voice/voice(_ZZN2hv22TcpClientEventLoopTmplINS_16WebSocketChannelEE12startConnectEvENKUlP4HBufE0_clES4_+0x54) [0x55848fcc10]
/opt/x/lib/voice/voice(_ZNSt17_Function_handlerIFvP4HBufEZN2hv22TcpClientEventLoopTmplINS3_16WebSocketChannelEE12startConnectEvEUlS1_E0_E9_M_invokeERKSt9_Any_dataOS1_+0x38) [0x55849028d4]
/opt/x/lib/voice/voice(_ZNKSt8functionIFvP4HBufEEclES1_+0x4c) [0x55848fa210]
/opt/x/lib/voice/voice(_ZN2hv7Channel7on_readEP5hio_sPvi+0x94) [0x55848f8d0c]
/opt/x/lib/voice/voice(hio_read_cb+0x88) [0x55848ec5b4]
/opt/x/lib/voice/voice(hio_handle_read+0x234) [0x55848ec460]
/opt/x/lib/voice/voice(+0x3577ac) [0x55848f27ac]
/opt/x/lib/voice/voice(+0x3584b0) [0x55848f34b0]
/opt/x/lib/voice/voice(+0x3587a4) [0x55848f37a4]
/opt/x/lib/voice/voice(+0x35428c) [0x55848ef28c]
/opt/x/lib/voice/voice(hloop_process_events+0x1f4) [0x55848ef578]
/opt/x/lib/voice/voice(hloop_run+0x15c) [0x55848f00f4]
/opt/x/lib/voice/voice(_ZN2hv9EventLoop3runEv+0x5c) [0x55848f79c8]
/opt/x/lib/voice/voice(_ZN2hv15EventLoopThread11loop_threadERKSt8functionIFivEES5_+0x100) [0x55848f85b8]
/opt/x/lib/voice/voice(_ZSt13__invoke_implIvMN2hv15EventLoopThreadEFvRKSt8functionIFivEES6_EPS1_JS4_S4_EET_St21__invoke_memfun_derefOT0_OT1_DpOT2_+0xa8) [0x55849088b8]
/opt/x/lib/voice/voice(_ZSt8__invokeIMN2hv15EventLoopThreadEFvRKSt8functionIFivEES6_EJPS1_S4_S4_EENSt15__invoke_resultIT_JDpT0_EE4typeEOSB_DpOSC_+0x78) [0x5584908730]
/opt/x/lib/voice/voice(_ZNSt6thread8_InvokerISt5tupleIJMN2hv15EventLoopThreadEFvRKSt8functionIFivEES8_EPS3_S6_S6_EEE9_M_invokeIJLm0ELm1ELm2ELm3EEEEvSt12_Index_tupleIJXspT_EEE+0x68) [0x5584908440]
/opt/x/lib/voice/voice(_ZNSt6thread8_InvokerISt5tupleIJMN2hv15EventLoopThreadEFvRKSt8functionIFivEES8_EPS3_S6_S6_EEEclEv+0x28) [0x55849081d4]
/opt/x/lib/voice/voice(_ZNSt6thread11_State_implINS_8_InvokerISt5tupleIJMN2hv15EventLoopThreadEFvRKSt8functionIFivEES9_EPS4_S7_S7_EEEEE6_M_runEv+0x18) [0x55849075a8]
/usr/lib/aarch64-linux-gnu/libstdc++.so.6(+0xccf9c) [0x7f91186f9c]
/usr/lib/aarch64-linux-gnu/libpthread.so.0(+0x7624) [0x7f91d80624]
/usr/lib/aarch64-linux-gnu/libc.so.6(+0xd149c) [0x7f90ff449c]

使用的代码比较简单

    hv::WebSocketClient ws;
    ws.onopen = [&]() {
      LOGI("[SDK] websocket open");
      ws.send(make_request(text));
    };
    ws.onmessage = [&](const std::string& msg) {
      ret = parse_reponse(msg);
      if (ret == TTS_END or ret == TTS_ERROR) {
        ws.stop();
        stop_event_.set();
      }
    };
    ws.onclose = [&]() {
      LOGI("[SDK] websocket close");
    };

    ws.open(wss_endpoint_.c_str(), headers_);
    stop_event_.wait();
    ws.close();
@ithewei
Copy link
Owner

ithewei commented Jan 6, 2025

我看堆栈里有startConnect,你是设置了重连吧,应该是WebSocketClient对象生命周期问题,ws.close后局部变量析构了,但是异步触发了重连之类的,建议使用new WebSocketClient,确保在onclose且不需要重连后再释放对象

@qZhang88
Copy link
Author

qZhang88 commented Jan 6, 2025

我应该没有设置重连吧,websocket相关代码都在这了。

@qZhang88
Copy link
Author

qZhang88 commented Jan 6, 2025

我有点明白你的意思了,ws.close后析构了,但是对面还在往回数据,然后重新实例化了,进行了重连。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants