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.

TMS320DM368: ALARM SERVER CREATE THREAD FAIL WITH ERROR CODE 11

Part Number: TMS320DM368

Hi,

I am currently working in DM368 Video Processor based project. I am using ipnc_rdk_dm36x_5.1_dm368 for the platform. I am currently facing an issue (only in the long run, that is after 2 or 3 days).  I got the following error:

Error: Alarm server creat thread fail 

with error code 11

We have sd recording scheduled and motion detection enabled.

After 2-3 days of long run only we will get the above error.

Could anyone suggest the reason for this issue?

Please help

Thanks in advance

  • Hi,

    I will inform IPNC Team to look into this issue.
    Can you please share log when you get this error.

    Regards,
    Anuj
    Pathpartner Technology Pvt Ltd.
  • Hi,

    I am attaching the log file .

    alarmissue.txt

  • Any updates?

    Note:

    After getting the thread create fail error the scheduled recording goes and after some time system_server process is killed and so watchdog is triggered.

    Please help on this issue.

    Thanks

  • Hi,

    Can you share your usecase code so that we can reproduce the same error at our side.

    Regards

    Anuj

  • Hi Anuj,

    We are currently using ipnc_rdk_dm36x_5.1_dm368. We are getting the error from following file's code snippet.

    Filename: ipnc_app/sys_server/src/alarm_main.c

    and the function is:

    int alarm_main_loop(int qid, int audQid, SemHandl_t hAlarmSem)

  • Hi,

    We have observed the issue even when only sd card recording or motion detection is enabled separately. The code snippet is given below.

    When we changed pthread_detach with pthread_join we got the issue much earlier. In the case of pthread_detach  we observed the issue after two days but with pthread_join we got it after 1 day.

    pEvironment = (AlarmParam_t*)malloc((sizeof(AlarmParam_t) + 32));

    if(pEvironment == NULL){
    printf("Error: More memory need for Alarm server\n");
    break;
    }
    pEvironment -> msg_id = qid;
    pEvironment -> audMsg_id = audQid;
    pEvironment->hAlarmSem = hAlarmSem;

    memcpy(&pEvironment -> msg_buf, &msgbuf, sizeof(msgbuf));

    if((ret = pthread_create(&thread, NULL, ProcAlarmThread, pEvironment)) != 0) {

    printf("thread fail return val %d\n", ret);

    free(pEvironment);

    printf("\nError: Alarm server creat thread fail\n");

    break;

    }

    pthread_detach(thread);

    //pthread_join(thread, NULL);

    Please help on this issue.

    Thanks

  • Hi,

    The following is the code snippet.

    We tested by  adding an attribute in this case(PTHREAD_CREATE_DETACHED). Still we got the same issue with error code 11.

    int alarm_main_loop(int qid, int audQid, SemHandl_t hAlarmSem)
    {
        ALARM_MSG_BUF msgbuf;
        int msg_size, ret = 0;
        int event_index, sch_index;
        AlarmParam_t* pEvironment;
        pthread_t thread;
        pthread_attr_t attr;
    
        pAlarmSysInfo = GetSysInfo();
        if((hGIOSem = MakeSem()) == NULL){
                return -1;
        }
    /* ADDED TO SEND SCHEDULE INFO TO SCHEDULE MANAGER */
      for (event_index = 0; event_index < MAX_NO_OF_EVENTS; event_index++) {
     for (sch_index = 0; sch_index < MAX_SCHEDULES; sch_index++) {
         Set_Event_Schedule(pAlarmSysInfo>event_details[event_index].event_schedule[sch_index], event_index, sch_index, 0);
                }
        }
        while(1){
                /* Get Message */
    msg_size = msgrcv( qid, &msgbuf, sizeof(msgbuf) - sizeof(long), MSG_TYPE_MSG1, 0);
                if( msg_size < 0 ){
                        printf("Alarm Receive msg fail \n");
                        ret = -1;
                        break;
                } else if(msgbuf.src == MSG_TYPE_MSG1 || msgbuf.src < 0){
                        printf("Got Error message\n");
                        ret = -1;
                        break;
                } else if(msgbuf.event == ALARM_EVENT_QUIT){
                        printf("Recieved Quit event\n");
                        break;
                } else if(IsRestart()){
                        // If already restart flag is set then ignore the messages
                    continue;
                } else {
                        /* Process alarm event */
               pEvironment =  (AlarmParam_t*)malloc(sizeof(AlarmParam_t));
               if(pEvironment == NULL){
               printf("Error: More memory need for Alarm server\n");
               break;
               }
                 pEvironment -> msg_id    = qid;
                 pEvironment -> audMsg_id = audQid;
                 pEvironment->hAlarmSem   = hAlarmSem;
                 memcpy(&pEvironment -> msg_buf, &msgbuf, sizeof(msgbuf));
                 pthread_attr_init(&attr);
                 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); 
                 if((ret = pthread_create(&thread, &attr, ProcAlarmThread,pEvironment)) != 0){
                      free(pEvironment);
                      printf("Error: Alarm server creat thread fail with error no %d\n", ret);
                      break;
                  }
                  pthread_attr_destroy(&attr);
                  pthread_detach(thread);
          }
        }
        DestroySem(hGIOSem);
        return ret;
    }

    Could you please help on this issue?

    Thanks