Ticket #512 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

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) (diff)

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

comment:1 Changed 10 years ago by bennylp

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

Fixed in r1868

Note: See TracTickets for help on using tickets.