Opened 17 years ago

Closed 17 years ago

#512 closed defect (fixed)

Bug in select ioqueue causing unnecessary sleep() to be invoked (thanks Sergey Bakulin)

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.9.0
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

The pjsip endpoint will invoke pj_thread_sleep() if pj_ioqueue_poll() returns error:

  c = pj_ioqueue_poll( endpt->ioqueue, &timeout);
  if (c < 0) {
    pj_thread_sleep(PJ_TIME_VAL_MSEC(timeout));

Unfortunately, the select ioqueue may incorrectly return error when select actually returns timeout:

 count = pj_sock_select(ioqueue->nfds+1, &rfdset, &wfdset, &xfdset, timeout);
 if (count <= 0)
   return -pj_get_netos_error();

Because of this, application may sleep for longer than what's required.

Please see http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-March/002054.html for the details.

Change History (1)

comment:1 Changed 17 years ago by bennylp

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r1868

Note: See TracTickets for help on using tickets.