Giter VIP home page Giter VIP logo

Comments (3)

davehorton avatar davehorton commented on September 28, 2024

The issue seems to be that the processData() function, which is running in the thread created to process responses from aws for that call, does not exit. I think to troubleshoot I suggest adding some more logging there.

Specifically, I wonder about this if condition

If that is not true -- if switch_core_session_locate(m_sessionId.c_str()); returns null, meaning the session is gone, I think we should add a log message so we can see that.

This log message:

stream got final response

Is the event that should cause the processData function to exit, and the thread to therefore end.

So if that is happening (I'm not sure it is) then we won't hit this code below in that if condition

				std::lock_guard<std::mutex> lk(m_mutex);
				m_finished = true;
				m_cond.notify_one();

				switch_core_session_rwunlock(psession);

That setting of the condition is what "wakes up" the processData() here:

		while (true) {
			std::unique_lock<std::mutex> lk(m_mutex);
			m_cond.wait(lk, [&, this] { 
				return (!m_deqAudio.empty() && !m_finishing)  || m_transcript.TranscriptHasBeenSet() || m_finished  || (m_finishing && !shutdownInitiated);
			});

Therefore, that thread may block there, waiting for a condition that never happens.

Just an idea, but try adding that logging to get further.

So...to summarize this theory:

  1. The session ends, as part of that we call m_pStream->close() at line 272
  2. This in turn causes AWS to complete transcribing and invoke OnResponseCallback
  3. In OnResponseCallback the call to switch_core_session_locate(m_sessionId.c_str()); fails because the session is gone
  4. Therefore no condition is raised and processData() blocks forever in its while loop

Please investigate when you have time @byoungdale and let me know what you think

from drachtio-freeswitch-modules.

byoungdale avatar byoungdale commented on September 28, 2024

Yes, thank you. Just saw this. The psession is gone, I had checked that. So, I added this else to the if (psession) { block:

				} else {
					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "GStreamer %p session is closed/hungup. Need to unblock thread.\n", this);
					std::lock_guard<std::mutex> lk(m_mutex);
					m_finished = true;
					m_cond.notify_one();
				}

and it unblocks processData's loop, I see the await ep.destroy() finishing, and I don't see the zombie call anymore.

But, does onResponseCallback only run when the transcription stream is finished? I'm having trouble finding AWS C++ SDK documentation that references onResponseCallback.

from drachtio-freeswitch-modules.

byoungdale avatar byoungdale commented on September 28, 2024

Ah, I see onResponseCallback is passed to StartStreamTranscriptionAsync.

from drachtio-freeswitch-modules.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.