Repository navigation
Conversation
Reason for change: None of the three task executors caught exceptions. A throwing task escaped the thread function and called std::terminate, killing the session-server process - and every session in it - with no error log. On the main thread a thrown exception also skipped the state->done signal, hanging any enqueueTaskAndWait waiter before termination. MainThread::mainThreadLoop, WorkerThread::taskHandler and EventThread::threadExecutor now catch std::exception and unknown exceptions, log them, and continue the loop. On the main thread the state->done signal still runs after a failed task so waiters are released. Test Procedure: Enqueue a throwing task on each executor; verify the process survives, the exception is logged, and enqueueTaskAndWait callers are released. Existing unit tests pass.
|
Pull request title must follow the pattern: Pull request description must follow the Commit message format for RDK-E:
< JIRA TICKET >: < one line summary of change less than 65 characters > |
There was a problem hiding this comment.
🟡 Changes recommended
Active critical issues can leave synchronous callers with uninitialized results or cause worker shutdown and promise-based calls to hang indefinitely.
3 open issues
What changed in this PR
This PR adds exception handling to three task executors so throwing tasks are logged rather than escaping their thread functions and terminating the process.
Changes:
- Catch standard and unknown exceptions around task execution.
- Continue processing subsequent tasks after an exception.
- Preserve main-thread completion notification so synchronous waiters are released.
| File | Description |
|---|---|
media/server/main/source/MainThread.cpp |
Catches task exceptions before notifying synchronous waiters. |
media/server/gstplayer/source/WorkerThread.cpp |
Logs task exceptions and continues the worker loop. |
common/source/EventThread.cpp |
Logs callback exceptions and resumes event processing. |
Review effort: Balanced
| catch (const std::exception &e) | ||
| { | ||
| RIALTO_COMMON_LOG_ERROR("Exception thrown by event thread callback: %s", e.what()); |
| catch (const std::exception &e) | ||
| { | ||
| RIALTO_SERVER_LOG_ERROR("Exception thrown by task on the worker thread: %s", e.what()); |
| catch (const std::exception &e) | ||
| { | ||
| RIALTO_SERVER_LOG_ERROR("Exception thrown by task on the main thread: %s", e.what()); |
|
Coverage statistics of your commit: |

Reason for change:
None of the three task executors caught exceptions. A throwing task escaped the thread function and called std::terminate, killing the session-server process - and every session in it - with no error log. On the main thread a thrown exception also skipped the state->done signal, hanging any enqueueTaskAndWait waiter before termination.
MainThread::mainThreadLoop, WorkerThread::taskHandler and EventThread::threadExecutor now catch std::exception and unknown exceptions, log them, and continue the loop. On the main thread the state->done signal still runs after a failed task so waiters are released.
Test Procedure:
Enqueue a throwing task on each executor; verify the process survives, the exception is logged, and enqueueTaskAndWait callers are released. Existing unit tests pass.