Why wait indefinitely for a pipe in a DestroyZoomVideoSDKObj call

@ chunsiong.zoom When I call DestroyZoomVideoSDKObj on the main thread, the main thread gets stuck.
It can be found from the stack that it is waiting indefinitely to read a pipeline message and has not been able to receive the message, so it has been stuck there.
Can you help analyze the reason for waiting indefinitely to read the pipeline message when releasing the object? Can we not wait indefinitely to read this pipe? The current version of SDK is 1.8.10. In addition, I tried to upgrade the SDK to 1.10.5, and the version higher than 1.8 will cause a segment error in the SSL inside my QNetworkManager.

#0 0x00007ffff6f19aff in __GI___poll (fds=0x7fffffffc1c0, nfds=1, timeout=-1) at …/sysdeps/unix/sysv/linux/poll.c:29
#1 0x00007fffc9cbfa3c in ssb::notifier_pipe_t::wait(int, bool) () from lib/libvideosdk.so.1
#2 0x00007fffc9ca4f7b in ssb::msg_queue_t::send_msg(ssb::msg_it*, ssb::msg_queue_sink_it*, int) () from lib/libvideosdk.so.1
#3 0x00007fffc9caf94a in ssb::thread_wrapper_t::stop() () from lib/libvideosdk.so.1
#4 0x00007fffc9cafba7 in ssb::thread_io_t::stop() () from lib/libvideosdk.so.1
#5 0x00007fffc9cb32e1 in ssb::thread_mgr_t::stop_threads_by_type(unsigned int) () from lib/libvideosdk.so.1
#6 0x00007fffc9c134ca in ssb::dns_provider_t::stop() () from lib/libvideosdk.so.1
#7 0x00007fffc9bfb90e in tp_uninit () from lib/libvideosdk.so.1
#8 0x00007fffc8d45ed5 in CSBWebServiceModuleClient::~CSBWebServiceModuleClient() () from lib/libvideosdk.so.1
#9 0x00007fffc8d45fe9 in CSBWebServiceModuleClient::~CSBWebServiceModuleClient() () from lib/libvideosdk.so.1
#10 0x00007fffc8d45b2b in TermWebServiceModule () from lib/libvideosdk.so.1
#11 0x00007fffc82afa4a in ZOOMLITESDK::iOSZoomRTCModuleMgr::UnloadInternal(bool) () from lib/libvideosdk.so.1
#12 0x00007fffc82ae4a3 in ZOOMLITESDK::CZoomRTCModuleMgr::Unload(bool) () from lib/libvideosdk.so.1
#13 0x00007fffc82a385c in ZOOMLITESDK::CZoomLITESDKContext::Uninit() () from lib/libvideosdk.so.1
#14 0x00007fffc82a0aeb in ZOOMLITESDK::CZoomRTCMgr::Shutdown(bool) () from lib/libvideosdk.so.1
#15 0x00007fffc82a0c30 in ZOOMLITESDK::CZoomRTCMgr::Cleanup() () from lib/libvideosdk.so.1
#16 0x00007fffc829484b in ZOOMVIDEOSDK::ZoomVideoSDK::UNInitialize() () from lib/libvideosdk.so.1
#17 0x00007fffc8296fb2 in ZOOMVIDEOSDK::ZoomVideoSDK::~ZoomVideoSDK() () from lib/libvideosdk.so.1
#18 0x00007fffc8297159 in ZOOMVIDEOSDK::ZoomVideoSDK::~ZoomVideoSDK() () from lib/libvideosdk.so.1
#19 0x00007fffc8298e06 in DestroyZoomVideoSDKObj () from lib/libvideosdk.so.1

@Wang ,

I’ve just tried something like this

void my_handler(int s)
{
	printf("\nCaught signal %d\n", s);
	
	printf("\Leaving Session\n");
	video_sdk_obj->leaveSession(false);
	printf("\Left Session\n");
	
	printf("\Cleaning up SDK\n");
	video_sdk_obj->cleanup();
	printf("\Cleaned up SDK\n");

	printf("\Destroying SDK Object\n");
	DestroyZoomVideoSDKObj();
	printf("\Destroyed SDK Object\n");
}

.
.
.
.
.

//in the main thread
	struct sigaction sigIntHandler;

	sigIntHandler.sa_handler = my_handler;
	sigemptyset(&sigIntHandler.sa_mask);
	sigIntHandler.sa_flags = 0;

	sigaction(SIGINT, &sigIntHandler, NULL);

	loop = g_main_loop_new(NULL, FALSE);

	// add source to default context
	g_timeout_add(100, timeout_callback, loop);
	g_main_loop_run(loop);
	return 0;
1 Like

Both cleanup and DestroyZoomVideoSDKObj wait for this pipe. DestroyZoomVideoSDKObj calls cleanup internally, and then deletes an object more than cleanup does.

I’ve tried to test it 25 times, and I’ve stuck once and crashed four times. Please also help analyze and locate the problem.
The crash stack is as follows:

Core was generated by `./zoom_v-sdk_linux_bot’.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f6313d681ca in ssb::thread_mgr_t::find_by_type(unsigned int) const () from libvideosdk.so.1
[Current thread is 1 (Thread 0x7f630b05c9c0 (LWP 8888))]
(gdb) bt
#0 0x00007f6313d681ca in ssb::thread_mgr_t::find_by_type(unsigned int) const () from libvideosdk.so.1
#1 0x00007f6313d68bbe in ssb::thread_mgr_t::stop_threads_by_type(unsigned int) () from libvideosdk.so.1
#2 0x00007f6313cc1c57 in ssb::dns_provider_t::~dns_provider_t() () from libvideosdk.so.1
#3 0x00007f6313cc1ce9 in ssb::dns_provider_t::~dns_provider_t() () from libvideosdk.so.1
#4 0x00007f6313caf894 in ssb::singleton_t<ssb::dns_provider_t, ssb::thread_mutex_recursive>::reset_all() () from libvideosdk.so.1
#5 0x00007f6313d5ef23 in ssb::singleton_life_t::cleanup() () from libvideosdk.so.1
#6 0x00007f6313d74913 in util_uninit () from libvideosdk.so.1
#7 0x00007f6313d74961 in sdk_global_exit () from libvideosdk.so.1
#8 0x00007f6312031ebc in ZOOMVIDEOSDK::ZoomVideoSDK::UNInitialize() () from libvideosdk.so.1
#9 0x00007f6312031ff9 in ZOOMVIDEOSDK::ZoomVideoSDK::cleanup() () from libvideosdk.so.1
#10 0x00005631524cb1bd in destroySDKObj () at /home/wangsheng/zoomvideodemo/videosdk-linux-raw-recording-sample-main/src/zoom_v-sdk_linux_bot.cpp:388
#11 0x00005631524d0958 in ZoomVideoSDKDelegate::onSessionLeave (this=0x56315430f220) at /home/wangsheng/zoomvideodemo/videosdk-linux-raw-recording-sample-main/src/zoom_v-sdk_linux_bot.cpp:130
#12 0x00007f6312031daf in ZOOMVIDEOSDK::ZoomVideoSDK::onConferenceLeftNotification() () from libvideosdk.so.1
#13 0x00007f6312054970 in ZOOMVIDEOSDK::CZoomLiteRTCConfStatusHandler::ProcConferenceLeftNotification(bool) () from libvideosdk.so.1
#14 0x00007f63120cc28b in ZMMeetingBridgeAsyncHelper::RunDelayTaskList(bool) () from libvideosdk.so.1
#15 0x00007f63120cc587 in non-virtual thunk to ZMMeetingBridgeAsyncHelper::OnTimer(void*, unsigned int, unsigned int, unsigned long) () from libvideosdk.so.1
#16 0x00007f6311fe31ee in Cmm::GLIBTimer_Notify(void*) () from libvideosdk.so.1
#17 0x00007f6310a6dbe8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#18 0x00007f6310a6d04e in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#19 0x00007f6310a6d400 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#20 0x00007f6310a6d6f3 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#21 0x00005631524cd3da in main (argc=1, argv=0x7ffe905fce18) at /home/wangsheng/zoomvideodemo/videosdk-linux-raw-recording-sample-main/src/zoom_v-sdk_linux_bot.cpp:680

1 Like

@Wang , are you able to capture the SDK log during the crash, and upload it somewhere?

Can you please give me your email? I’ll email you.

@Wang I’m creating a ticket from my side. I’ll provide you with updates here

ZSEE-120336

  • tan:
    • Thank you for your help!Due to the fact that the OpenSSL version in my current environment is 1.1.1, I am using SDK1.8.10. How can I get your updates? I don’t know what ZSEE-120336 is.

Chun Siong (tag me for response) via Zoom Developer Forum <notifications@zoomdeveloper.discoursemail.com> 于2024年2月23日周五 12:53写道:

@Wang , do you have a portion of the code on how you are calling DestroyZoomVideoSDKObj? We are trying to replicate this on our side

void destroySDKObj()
{
    if(video_sdk_obj)
    {
        video_sdk_obj->cleanup();
        std::cout << "clearn up" << std::endl;
        DestroyZoomVideoSDKObj();
        std::cout << "destory" << std::endl;
        video_sdk_obj = nullptr;
    }
}

/// \brief Triggered when session leaveSession
virtual void onSessionLeave()
{
    g_main_loop_unref(loop);
    std::cout << __PRETTY_FUNCTION__ << " Already left session" << std::endl;
    destroySDKObj();
    exit(1);
};

@Wang ,

I’ve checked with our team, it might not be suitable to destroy the sdk obj in onSessionLeave. Is it possible to call it in other methods instead?

The following is for use in a real development environment without releasing SDK resources in onLeaveSession.The program will still crash or get stuck.

MainWindow::on_pushButton_Quit()
{
    ReleaseResourceService releaseService;
}

ReleaseResourceService::ReleaseResourceService(QObject *parent) :
    QObject(parent)
{
    bool waitHangup = SharedSingleton<ZoomTeleMedicine>::getInstance()->meetingStatus() >= ZOOMJOINING; 
    ZoomListenerWatcher *zoomListenerWatcher =  dynamic_cast<ZoomListenerWatcher*>(SharedSingleton<ZoomVideoService>::getInstance()->getListenerWatcher()); // get zoomdelegate listener
    if(waitHangup)
    {
        if(zoomListenerWatcher)
        {
            connect(zoomListenerWatcher, &ZoomListenerWatcher::notifyLocalUserLeave, this, [=](const QString &userId, const QString &userName){
                //This is entered when onSessionLeave is triggered
                Q_UNUSED(userId);
                Q_UNUSED(userName);
                exitWatcher->notify(NO_ERR, "", "");    //Notifies to exit the event loop
            });
            connect(zoomListenerWatcher, &ZoomListenerWatcher::notifyError, this, [=](int errorCode, int detailErrorCode){
                //This is entered when onError is triggered
                Q_UNUSED(errorCode);
                Q_UNUSED(detailErrorCode);
                exitWatcher->notify(NO_ERR, "", "");  //Notifies to exit the event loop
            });
            QEventLoop loop;
            connect(exitWatcher.get(), &ExitWatcher::notifyEixt, &loop, &QEventLoop::quit); 
            if(SharedSingleton<ZoomTeleMedicine>::getInstance()->hangUpCall()) 
            {
                loop.exec();  //Wait for exit notice
            }
        }
    }
    SharedSingleton<ZoomVideoService>::getInstance()->unInit(); // call release zoom video sdk
}

@Wang ,

do you have the logs captured for this implementation?

@chunsiong.zoom I sent you an email and asked you to help analyze it.

@chunsiong.zoom Have there been any new findings in the analysis of program crashes and freezing issues?