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.

Socket creation : invalid task priority

Other Parts Discussed in Thread: SYSBIOS

Hi,

Using sys bios6 from 6616 simulator..

Trying to create socket from a user defined task and getting error "

ti.sysbios.knl.Task: line 895: assertion failure: A_badPriority: An invalid task priority was used"

Task created like below:

Task_Params taskParams;

Task_Params_init(&taskParams);

taskParams.stackSize = 1024;

taskParams.priority = 15;

taskParams.instance->name =

"my task";

taskParams.arg0 = 2;

Error_Block eb;

Error_init(&eb);

task = Task_create(taskFxn, &taskParams, &eb);

 

Socket function called and getting error from below line.

if(0 > (fd_ = ::socket(sockDomain, sockType, protocol)))

 

Please let me know why this is happening...Also this is not done in idle task as NDK may try to increase the priotiy. So why this problem is happening in a user defined task?

regards

Soumya

  • Do you setup a file descriptor (fd) session before calling the socket function?  This can be done in the Task itself.  e.g.:

    static HANDLE hMyTask=0;

    hMyTask = TaskCreate(taskFxn, "&tskFxn", OS_TASKPRINORM, OS_TASKSTKNORM, 0,0, 0);
    fdOpenSession(hMyTask);

  • Soumya,

    The network stack subsystem internally uses tasks. It relies on task priorities to insure mutual exclusion so internal data structures are not corrupted. This means that application tasks that use networking need to have priorities lower than the network stack task(s) priority. This is documented in the NDK Reference Guide in Section 2.1.1. The default network task priority is 9, so your example above with priority of 15 will not work. It needs to be priority 7 or lower (explained in doc above). You can change the priority settings for the network stack through the graphical config tool (if you are using that) or via the C code that initializes the stack.

    Mark

  • Hi Nick and Mark,

    Thanks for your response.The priority problem is solved but still the socket is not getting created.

    I saw at ROV that NDK task running at priority 5, i kept my app task priority at 1. Also I have used fdOpenSession() with task handle before creating the socket. But still the socket descriptor value is 0xffffffff. Also the fderror() output is also coming 0xffffffff.

     I have put almost all the section in DDR3 still its OOM coming..is it the problem?

    [TMS320C66x_0] 00000.000 fdOpenSession: OOM

    [TMS320C66x_0] socket descriptor = ffffffff ffffffff

    Please note I have configured my ccsv5 simulator as per http://processors.wiki.ti.com/index.php/BIOS_MCSDK_2.0_User_Guide#Building_and_running_NDK_client_example_with_simulator.

    Please help me to solve this problem.

    Code block:

    fdOpenSession(task);  

    if ((s=socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP))== INVALID_SOCKET)


    System_printf(" socket descriptor = %x %x\n",s, fdError());

     

    Regards

    Soumya

  • Soumya,

    This looks like your heap is all used up.  You can verify in ROV under heaps.

    You can set/increase the heap size in your *.cfg file with the following:

        BIOS.heapSize = <desired heap size>;

    Steve

  • Well this got solved when I executed the same from the call back of Netstart.