Try to reprepare when IPC I/O error occurs 29/285229/3
authorSuyeon Hwang <stom.hwang@samsung.com>
Thu, 8 Dec 2022 02:02:12 +0000 (11:02 +0900)
committerSuyeon Hwang <stom.hwang@samsung.com>
Thu, 8 Dec 2022 04:57:05 +0000 (13:57 +0900)
- Issue:
TTS API will be failed when the engine is terminated after the client
library already sends request.

- Solution:
Current client library does not handle the network connection failed
situation because almost those situations are covered by reprepare
logic. However, if the engine is terminated without handling client IPC
message, client library should returns error.
Thus, this patch adds new retry logic when network error occurs. Through
this logic, some of the issue case will be covered. However, if engine
has critical issue, then this logic also can cover those situations.

Change-Id: I07075e0139d058f9f9bc84026a00309bf1815066
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
client/tts_core.c
client/tts_tidl.c

index 34d7679f696c396f0c93f7962ac8d7bb0fb1ea88..74fc0953f1b10d644fff039c402a1082789623f6 100644 (file)
@@ -597,8 +597,14 @@ static inline bool __is_ipc_retry_needed(tts_client_s* client, tts_error_e ret)
                return true;
        }
 
-       if (TTS_ERROR_INVALID_PARAMETER == ret && false == tts_client_is_reprepared(client)) {
-               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] IPC is failed by unregistered client. ret(%d/%s)", ret, get_error_message(ret));
+       if (tts_client_is_reprepared(client)) {
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Prepare was already tried.");
+               SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] IPC request is failed. ret(%d/%s)", ret, get_error_message(ret));
+               return false;
+       }
+
+       if (TTS_ERROR_INVALID_PARAMETER == ret || TTS_ERROR_IO_ERROR == ret) {
+               SLOG(LOG_WARN, TAG_TTSC, "[WARNING] IPC is failed by unregistered client or network error. ret(%d/%s)", ret, get_error_message(ret));
                SLOG(LOG_WARN, TAG_TTSC, "[WARNING] Try to prepare again");
                tts_client_set_current_state(client, TTS_STATE_CREATED);
                tts_core_prepare_sync(client);
index 36bfa0e6a195a14b94c784f1fe2cb5098336d502..dd10bc833b3a016eea6a60b69407727586e17ebd 100644 (file)
@@ -394,8 +394,15 @@ static int __request_tidl_connect_sync(tts_tidl_info_s* info)
 
 static int __convert_unhandled_error(int ret)
 {
-       if (RPC_PORT_ERROR_IO_ERROR == ret || RPC_PORT_ERROR_OUT_OF_MEMORY == ret) {
-               return TTS_ERROR_OPERATION_FAILED;
+       switch (ret) {
+       case RPC_PORT_ERROR_IO_ERROR:
+               return TTS_ERROR_IO_ERROR;
+
+       case RPC_PORT_ERROR_OUT_OF_MEMORY:
+               return TTS_ERROR_OUT_OF_MEMORY;
+
+       default:
+               break;
        }
 
        return ret;