This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OSA_thrCreate failed 11

hi all.i do the stability test.i init all the cap ,enc,dec,dis,all the links and then i stop and delete the links .

in the test i don't have enc and dec data thread.but when i run the app circurately to about 205 times,it will has following error:

[host] HDMI Ctrl :Initializing
ERROR (osa_thr.c|OSA_thrCreate|42): OSA_thrCreate() - Could not create thread [11]
ASSERT (osa_thr.c|OSA_thrCreate|43)
[m3video] DECLINK_H264:HEAPID:0 USED:2368
[m3video] DECLINK_H264:HEAPID:3 USED:4505600
[m3video] 972497: DECODE: Creating CH14 of 720 x 576 [PROGRESSIVE] [TILED ],target bitrate = 2000 Kbps ...
[m3video] 972498: DECODE: All CH Create ... DONE !!!
[m3video] DECLINK:HEAPID:0 USED:35640
[m3video] DECLINK:HEAPID:3 USED:67584000
[m3video] 972501: DECODE: Create ... DONE !!!
[m3video] 972502: IPC_OUT_M3 : Create in progress !!!
[m3video] 972502: IPC_OUT_M3 : Create Done !!!

  • Pls print the number of threads in the process by checking under /proc/<pid>/task folder when the OSA_thrCreate error occurs. Also share logs of mallinfo() when you hit the error condition .Below is example code to print number of threads:

    #include <dirent.h>
    #include <sys/types.h>
    #include <unistd.h>
    
    Int32 OSA_GetThreadCount()
    {
        Int32 file_count = 0;
        DIR * dirp;
        struct dirent * entry;
        pid_t cur_pid;
        char thread_count_path[1024];
    
        cur_pid = getpid();
        printf("\nOSA: Getting thread count for process:%d\n",cur_pid);
        snprintf(thread_count_path,sizeof(thread_count_path) - 1,"/proc/%d/task",cur_pid);
        thread_count_path[sizeof(thread_count_path) - 1] = 0;
    
        printf("\nOSA: Thread Count paths:%s\n",thread_count_path);
        dirp = opendir(thread_count_path); /* There should be error handling after this */
        if (dirp == NULL)
            return -1;
        while ((entry = readdir(dirp)) != NULL) {
            file_count++;
        }
        closedir(dirp);
        printf("\nOSA: Thread Count :%d\n",file_count);
        return file_count;
    }

  • hi Badri ,i do some test like you say.i just do the following operator

    Vsys_params_init(&vsysParams);
    Vsys_init(&vsysParams);

    then 

    do some about the dis init operator,and i don't create any about the dis link

    next i call the Vdis_start()

    last i do the exit operator

    Vdis_hdmiCtrl_stop()

    Vsys_deConfigureDisplay();

    Vdis_exit();

    Vsys_exit();

    all the above is in a while(1)

    i found the thread count after the sysinit is increase

    when the thread created failed ,the statistic result is following 

    Total non-mmapped bytes (arena): 135168
    # of free chunks (ordblks): 2
    # of free fastbin blocks (smblks): 0
    # of mapped regions (hblks): 0
    Bytes in mapped regions (hblkhd): 0
    Max. total allocated space (usmblks): 0
    Free bytes held in fastbins (fsmblks): 0
    Total allocated space (uordblks): 50960
    Total free space (fordblks): 84208
    Topmost releasable block (keepcost): 84168

    @@@@@OSA: Getting thread count for process:633

    @@@@@OSA: Thread Count paths:/proc/633/task

    @@@@@OSA: Thread Count :49
    [host] HDMI Ctrl :Initializing
    ERROR (osa_thr.c|OSA_thrCreate|42): OSA_thrCreate() - Could not create thread [11]
    ASSERT (osa_thr.c|OSA_thrCreate|43)
    [host] HDMI Ctrl : ERROR :Could not get sink connection status
    [host] HDMI Ctrl : ERROR :Terminating HDMI control demo.
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [Done]
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI
    [host] HDMI Ctrl :Exiting control thread... [host] HDMI Ctrl : ERROR :Could not stop HDMI

  • i found that in the dis init funtion

    Vdis_init() call the function Vdis_hdmiCtrl_init()

    will create a thread.

    but when exit the dis,how to stop and exit the thread 

    tks

  • Below is the code to print thread id. I am not sure if this function is included in your RDK codebase:

    #include <unistd.h>
    #include <sys/syscall.h>
    #include <sys/types.h>
    
    void
    OSA_printTID(const char *threadName)
    {
        pid_t tid;
    
        tid = syscall(SYS_gettid);
        printf("[HOST] \nThreadName:%s,ThreadID:%d\n",threadName,tid);
    }


    Pls add below line in file /dvr_rdk/mcfw/src_linux/mcfw_api/ti_vdis_hdmi_ctrl_priv.c

     

    static void *Vdis_hdmiControlThread(void * ctrlInst)

        VDIS_HDMI_CNTRL_INST *pCtrlInst = (VDIS_HDMI_CNTRL_INST *) ctrlInst;
        int status = OSA_SOK;
        struct ti81xxhdmi_status hdmiStatus;
        OSA_MsgHndl *pMsg;
        int sendEvent;
     char threadName[128]; snprintf(threadName,sizeof(threadName),"%s_%x",__func__,0); threadName[sizeof(threadName) - 1] = 0; OSA_printTID(threadName); 

     

     

    Note down the thread id in each iteration and then do ls -l /proc/<pid>/task/ and check if the thread id not deleted in each iteration matches the HDMI control thread. Exiting the thread handler function should delete the thread so I am not sure if this is the thread that is not deleted.

  • This is an old thread/question, but we recently experienced this same issue in one of our applications that required restarting the mcfw multiple times.  We applied the following to fix the issue:

    diff --git a/mcfw/src_linux/mcfw_api/ti_vdis_hdmi_ctrl_priv.c b/mcfw/src_linux/mcfw_api/ti_vdis_hdmi_ctrl_priv.c
    index 58c5136..c08bc33 100755
    --- a/mcfw/src_linux/mcfw_api/ti_vdis_hdmi_ctrl_priv.c
    +++ b/mcfw/src_linux/mcfw_api/ti_vdis_hdmi_ctrl_priv.c
    @@ -213,6 +213,8 @@ Int32 Vdis_hdmiCtrl_deInit(void)
         {
             gCtrlInst.exitCtrlthread = EXIT_CONTROL_THREAD;
         }
    +    
    +    OSA_thrDelete(&gCtrlInst.ctrlThread);
     
         return 0;
     }
    

  • Hello,

    Thank you for sharing the solution.

    BR
    Margarita