getnamo / SocketIOClient-Unreal

Socket.IO client plugin for the Unreal Engine.
Other
898 stars 240 forks source link

Will cause a crash if connection while closing? #359

Open xiaoaq opened 1 year ago

xiaoaq commented 1 year ago

I found the socketio exception stack in a crash log, as follows:

Line 30801: 12-01 19:39:22.840857 23165 23367 D UE4     : [2022.12.01-11.39.22:840][887]LogSIOClient_Impl: Connected.
Line 30802: 12-01 19:39:22.841008 23165 23367 D UE4     : [2022.12.01-11.39.22:840][887]LogSIOClient_Impl: SIOClient socket on_handshake pingInterval=25000 m_ping_timeout=60000
Line 31349: 12-01 19:39:27.874176 23165 23367 D UE4     : [2022.12.01-11.39.27:874][389]LogSIOClient_Impl: Close by reason: End by user
Line 31350: 12-01 19:39:27.902537 23165 23367 D UE4     : [2022.12.01-11.39.27:902][393]LogSIOClient_Impl: Client Disconnected.
Line 31351: 12-01 19:39:27.902575 23165 23367 D UE4     : [2022.12.01-11.39.27:902][393]LogSIOClient_Impl: clear timers
Line 31433: 12-01 19:39:30.591770 23165 23397 D UE4     : [2022.12.01-11.39.30:591][603]LogSIOClient_Impl: Close by reason: End by user
Line 31434: 12-01 19:39:30.591800 23165 23397 D UE4     : [2022.12.01-11.39.30:591][603]LogSIOClient_Impl: Warning: close_impl::Error: No active session: End by user
Line 31438: 12-01 19:39:30.638949 23165 23397 D UE4     : [2022.12.01-11.39.30:638][603]LogSIOClient_Impl: Connected.

12-01 19:39:31.022592 23405 23405 I crash_dump64: performing dump of process 23165 (target tid = 23397) 12-01 19:39:31.029010 23405 23405 F DEBUG : 12-01 19:39:31.029113 23405 23405 F DEBUG : Build fingerprint: 'Pico/A7H10/PICOA7H10:10/4.9.5/smartcm.1665594733:user/dev-keys' 12-01 19:39:31.029122 23405 23405 F DEBUG : Revision: '0' 12-01 19:39:31.029128 23405 23405 F DEBUG : ABI: 'arm64' 12-01 19:39:31.029360 23405 23405 F DEBUG : Timestamp: 2022-12-01 19:39:31+0800 12-01 19:39:31.029415 23405 23405 F DEBUG : pid: 23165, ppid: 679, tid: 23397, name: TAsync 1 >>> com.xx.xx.beta <<< 12-01 19:39:31.029421 23405 23405 F DEBUG : uid: 11364 12-01 19:39:31.029428 23405 23405 F DEBUG : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- 12-01 19:39:31.029448 23405 23405 F DEBUG : Abort message: 'terminating' 12-01 19:39:31.029459 23405 23405 F DEBUG : x0 0000000000000000 x1 0000000000005b65 x2 0000000000000006 x3 00000072728dafe0 12-01 19:39:31.029466 23405 23405 F DEBUG : x4 fefeff71718cadaf x5 fefeff71718cadaf x6 fefeff71718cadaf x7 7f7f7f7f7fffffff 12-01 19:39:31.029472 23405 23405 F DEBUG : x8 00000000000000f0 x9 53193b8a22595a89 x10 0000000000000001 x11 0000000000000000 12-01 19:39:31.029479 23405 23405 F DEBUG : x12 fffffff0fffffbdf x13 00000323affb2bef x14 0025db1eaa7e8545 x15 0000000034155555 12-01 19:39:31.029485 23405 23405 F DEBUG : x16 00000073f57219c0 x17 00000073f56fa330 x18 000000722f5fa000 x19 0000000000005a7d 12-01 19:39:31.029491 23405 23405 F DEBUG : x20 0000000000005b65 x21 00000000ffffffff x22 00000072903dc6f8 x23 00000072903dc080 12-01 19:39:31.029497 23405 23405 F DEBUG : x24 00000072728dc020 x25 00000072728db330 x26 00000072728dc020 x27 0000007302e55b30 12-01 19:39:31.029503 23405 23405 F DEBUG : x28 00000073036a2740 x29 00000072728db080 12-01 19:39:31.029508 23405 23405 F DEBUG : sp 00000072728dafc0 lr 00000073f56abb84 pc 00000073f56abbb0 12-01 19:39:31.034947 23165 23195 D UE4 : [2022.12.01-11.39.31:034][603]LogAudio: Display: Audio Device unregistered from world 'None'. 12-01 19:39:31.138616 875 22823 E Stationservice: L1:SlpiDataAnalyze right imu1 cnt=0, ts=0, imu2 cnt=105, acc_x=1.954336, ts=179782331529, touch_trigger:0, rocker:128,128, trigger:0, bat:5, mRadioType:2 12-01 19:39:31.138891 23165 23195 D UE4 : [2022.12.01-11.39.31:138][603]LogTemp: Warning: IsUObjectValid pUObject no valid this=0x7283885da0 GPlayInEditorID=-1 12-01 19:39:31.139073 23405 23405 F DEBUG : 12-01 19:39:31.139073 23405 23405 F DEBUG : backtrace: 12-01 19:39:31.139108 23405 23405 F DEBUG : #00 pc 0000000000086bb0 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.139125 23405 23405 F DEBUG : #01 pc 00000000000eb910 /apex/com.android.runtime/lib64/bionic/libc.so (fortify_fatal(char const, ...)+120) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.139137 23405 23405 F DEBUG : #02 pc 00000000000eafb0 /apex/com.android.runtime/lib64/bionic/libc.so (HandleUsingDestroyedMutex(pthread_mutex_t, char const*)+52) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.139146 23405 23405 F DEBUG : #03 pc 00000000000eae64 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_mutex_lock+228) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.139159 23405 23405 F DEBUG : #04 pc 0000000000091b6c /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libc++_shared.so (std::ndk1::mutex::lock()+8) (BuildId: ece72a2ebc3774a1be9fd21271258acd3bcdfaa7) 12-01 19:39:31.139173 23405 23405 F DEBUG : #05 pc 0000000007bf836c /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN3sio11client_impl19sockets_invoke_voidEMNS_6socketEFvvE+76) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139186 23405 23405 F DEBUG : #06 pc 0000000007bf694c /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (sio::client_impl::on_open(std::ndk1::weak_ptr)+260) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139198 23405 23405 F DEBUG : #07 pc 0000000007c0f8dc /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZNSt6ndk110function6funcINS_6bindIMN3sio11client_implEFvNS_8weak_ptrIvEEEJPS4_RKNS_12placeholders4phILi1EEEEEENS_9allocatorISF_EEFvS6EEclEOS6+68) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139218 23405 23405 F DEBUG : #08 pc 0000000007c5ab20 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (websocketpp::connection::handle_read_http_response(std::ndk1::error_code const&, unsigned long)+1480) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139242 23405 23405 F DEBUG : #09 pc 0000000007c29bb4 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (websocketpp::transport::asio::connection::handle_async_read(std::ndk1::function<void (std::ndk1::error_code const&, unsigned long)>, std::ndk1::error_code const&, unsigned long)+336) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139275 23405 23405 F DEBUG : #10 pc 0000000007c2bc70 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZNSt6ndk16bindIMN11websocketpp9transport4asio10connectionINS1_6config11asio_client16transport_configEEEFvNS_8functionIFvRKNS_10error_codeEmEEESC_mEJNS_10shared_ptrIS8_EERSE_RKNS_12placeholders4phILi1EEERKNSL_ILi2EEEEEclIJRSA_RmEEENS_13bind_returnISG_NS_5tupleIJSI_SE_SM_SP_EEENSX_IJDpOT_EEEXsr22is_valid_bind_returnISG_SY_S12EE5valueEE4typeES11+168) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139298 23405 23405 F DEBUG : #11 pc 0000000007c2b728 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN4asio6detail14strand_service8dispatchINS0_7binder2IN11websocketpp9transport4asio20custom_alloc_handlerINSt6ndk16bindIMNS6_10connectionINS4_6config11asio_client16transport_configEEEFvNS8_8functionIFvRKNS8_10error_codeEmEEESI_mEJNS8_10shared_ptrISE_EERSK_RKNS8_12placeholders4__phILi1EEERKNSR_ILi2EEEEEEEESG_mEEEEvRPNS1_11strandimplERT+144) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139313 23405 23405 F DEBUG : #12 pc 0000000007c2a02c /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN4asio6detail15wrapped_handlerINS_10io_context6strandEN11websocketpp9transport4asio20custom_alloc_handlerINSt6ndk16bindIMNS6_10connectionINS4_6config11asio_client16transport_configEEEFvNS8_8functionIFvRKNS8_10error_codeEmEEESI_mEJNS8_10shared_ptrISE_EERSK_RKNS8_12placeholders4phILi1EEERKNSR_ILi2EEEEEEEENS0_26is_continuation_if_runningEEclISG_mEEvRKTRKT0+208) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139332 23405 23405 F DEBUG : #13 pc 0000000007c2ad04 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN4asio6detail18completion_handlerINS0_17rewrapped_handlerINS0_7binder2INS0_7read_opINS_19basic_stream_socketINS_2ip3tcpEEENS_17mutable_buffers_1EPKNS_14mutable_bufferENS0_19transfer_at_least_tENS0_15wrapped_handlerINS_10io_context6strandEN11websocketpp9transport4asio20custom_alloc_handlerINSt6ndk16__bindIMNSJ_10connectionINSH_6config11asio_client16transport_configEEEFvNSL_8functionIFvRKNSL_10error_codeEmEEESV_mEJNSL_10shared_ptrISR_EERSX_RKNSL_12placeholders4phILi1EEERKNS14_ILi2EEEEEEEENS0_26is_continuation_if_runningEEEEEST_mEES1C_EEE11do_completeEPvPNS0_19scheduler_operationESV_m+136) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139353 23405 23405 F DEBUG : #14 pc 0000000007c2ab90 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN4asio6detail14strand_service8dispatchINS0_17rewrapped_handlerINS0_7binder2INS0_7read_opINS_19basic_stream_socketINS_2ip3tcpEEENS_17mutable_buffers_1EPKNS_14mutable_bufferENS0_19transfer_at_least_tENS0_15wrapped_handlerINS_10io_context6strandEN11websocketpp9transport4asio20custom_alloc_handlerINSt6ndk16bindIMNSK_10connectionINSI_6config11asio_client16transport_configEEEFvNSM_8functionIFvRKNSM_10error_codeEmEEESW_mEJNSM_10shared_ptrISS_EERSY_RKNSM_12placeholders4phILi1EEERKNS15_ILi2EEEEEEEENS0_26is_continuation_if_runningEEEEESU_mEES1D_EEEEvRPNS1_11strandimplERT+376) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139375 23405 23405 F DEBUG : #15 pc 0000000007c2a5c8 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZN4asio6detail23reactive_socket_recv_opINS_17mutable_buffers_1ENS0_7read_opINS_19basic_stream_socketINS_2ip3tcpEEES2_PKNS_14mutable_bufferENS0_19transfer_at_least_tENS0_15wrapped_handlerINS_10io_context6strandEN11websocketpp9transport4asio20custom_alloc_handlerINSt6ndk16bindIMNSH_10connectionINSF_6config11asio_client16transport_configEEEFvNSJ_8functionIFvRKNSJ_10error_codeEmEEEST_mEJNSJ_10shared_ptrISP_EERSV_RKNSJ_12placeholders4phILi1EEERKNS12_ILi2EEEEEEEENS0_26is_continuation_if_runningEEEEEE11do_completeEPvPNS0_19scheduler_operationEST_m+412) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139389 23405 23405 F DEBUG : #16 pc 0000000007c12134 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (asio::detail::scheduler::do_run_one(asio::detail::conditionally_enabled_mutex::scoped_lock&, asio::detail::scheduler_thread_info&, std::ndk1::error_code const&)+708) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139399 23405 23405 F DEBUG : #17 pc 0000000007c11c90 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (asio::detail::scheduler::run(std::ndk1::error_code&)+216) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139416 23405 23405 F DEBUG : #18 pc 0000000007bfb120 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (websocketpp::transport::asio::endpoint::run()+52) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139425 23405 23405 F DEBUG : #19 pc 0000000007bf9c74 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (sio::client_impl::run_loop()+24) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139439 23405 23405 F DEBUG : #20 pc 0000000007c10f78 /data/app/com.xx.xx.beta-5bZfPkkOqWMVTefoZXkZAg==/lib/arm64/libUE4.so (_ZNSt6ndk114thread_proxyINS_5tupleIJNS_10unique_ptrINS_15thread_structENS_14default_deleteIS3_EEEENS_6__bindIMN3sio11client_implEFvvEJPS9EEEEEEEEPvSF+64) (BuildId: 15556f3b49f0465ba9a7201c5c74f82fc8e9ac43) 12-01 19:39:31.139450 23405 23405 F DEBUG : #21 pc 00000000000ea2d0 /apex/com.android.runtime/lib64/bionic/libc.so (pthread_start(void*)+36) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.139457 23405 23405 F DEBUG : #22 pc 000000000008862c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 8d43fa0e64a99082beeeef2411cd9365) 12-01 19:39:31.149096 23165 23195 D UE4 : [2022.12.01-11.39.31:149][603]LogSlate: Slate User Unregistered. User Index 8 12-01 19:39:31.149226 23165 23195 D UE4 : [2022.12.01-11.39.31:149][603]LogSlate: Slate User Destroyed. User Index 8, Is Virtual User: 1 12-01 19:39:31.157401 23165 23195 D UE4 : [2022.12.01-11.39.31:157][603]LogUObjectHash: Compacting FUObjectHashTables data took 7.30ms 12-01 19:39:31.187764 23165 23195 D UE4 : [2022.12.01-11.39.31:187][603]Slua: Unreal engine GC, lua used 7875 KB 12-01 19:39:31.206425 23165 23195 D UE4 : [2022.12.01-11.39.31:206][603]LogStreaming: Display: FlushAsyncLoading: 1 QueuedPackages, 0 AsyncPackages 12-01 19:39:31.209338 2375 2399 I PvrFit.FitDataProvider: Provider开始执行query

I'm not sure whether this exception directly caused the crash of the application. It seems that ue4 switched the level and closed the socket when it was about to connect, which then caused the exception.

xiaoaq commented 1 year ago

It happend at: Pico + UE4 + Android10 + VR. I tried to reproduce it on the PC side, and immediately disconnected while connecting, and there was no crash。

PC Log: Slua: [API] MethodName: GameList, messageBody={"code":200,"success":true,"data":{"records":[{"gameId":118,"clientVersion":"","position":4,"gameImages":[],"gameNoticeImages":["https://static-mjsjtest.cdn.bcebos.com/upload/20220624/2022b0ca779e9dcd LogSIOClient_Impl: Close by reason: End by user LogSIOClient_Impl: Warning: close_impl::Error: No active session: End by user LogSIOClient_Impl: Connection opened while closing. LogSIOClient_Impl: Close by reason: End by user LogSIOClient_Impl: Warning: close_impl::Error: No active session: End by user LogSIOClient_Impl: SIOClient socket on_handshake pingInterval=25000 m_ping_timeout=60000 LogSIOClient_Impl: Close by reason: End by user LogSIOClient_Impl: Warning: close_impl::Error: No active session: End by user LogWorld: UWorld::CleanupWorld for Home_Level, bSessionEnded=true, bCleanupResources=true LogSIOClient_Impl: Client Disconnected. LogSIOClient_Impl: clear timers LogSIOClient_Impl: Client Disconnected. LogSIOClient_Impl: clear timers

getnamo commented 1 year ago

It largely depends on how you're using the socket.io connection. If you're using the standard way (socketio component) it should cleanly exit the connection between level transitions. If you're using native c++ (FSocketIONative) things might get complicated if you don't use the NewValidNativePointer() and ReleaseNativePointer() as shown in https://github.com/getnamo/SocketIOClient-Unreal#c-fsocketionative.

Keep in mind that the cleanup thread needs ~ 1 second to release a connection correctly. All connections get released simultaneously as separate threads in your threadpool.