Hi Benny, On 18 Aug 2008, at 17:34, Benny Prijono wrote: > On Mon, Aug 18, 2008 at 3:52 PM, Ruud Klaver <ruud at ag-projects.com> > wrote: > Hi, > > On 18 Aug 2008, at 13:56, Benny Prijono wrote: > > > On Mon, Aug 18, 2008 at 11:23 AM, Ruud Klaver <ruud at ag-projects.com> > > wrote: > > Hi, > > > > I'm running into an issue in the following situation (sorry about > the > > lack of code): > > > > 1. I do pjmedia_endpoint_create with 0 threads, giving it the > ioqueue > > from my pjsip_enpoint using pjsip_endpt_get_ioqueue > > 2. I have a worker thread that does pjsip_endpt_handle_events in a > > loop > > 3. I call pjmedia_transport_udp_create to create a RTP/RTCP over UDP > > port pair > > 4. I destroy the UDP transport using pjmedia_transport_close > > 5. pjsip_endpt_handle_events returns the ETIMEDOUT ("Operation timed > > out") system error. > > > > On Linux this problem does not occur, it seems to be OS X specific. > > Maybe it has something to do with the bug discussed in this > thread: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-April/002531.html > > > > > > That looks plausible, you can try the patch mentioned in that thread > > to see if that fixes it. Or otherwise get the latest version. ;-) > > > > Cheers > > Benny > > > > > > Any idea what's going on here? > > > > Ruud Klaver > > AG Projects > > > > Sorry, I probably should have mentioned I am using the code from SVN, > so this patch is already included. > > > Yes it should have been included. I'm not sure now what might have > caused this, but one possible reason is select() returns -1 and > errno is set to ETIMEDOUT. If this is a temporal error then perhaps > we can ignore it. > > -benny You were right about the select() failing. I have traced the sequence of events to the following: 1. select() returns -1 and errno is set to EBADF (Bad file descriptor). 2. pj_ioqueue_poll returns this errno value in pj style and negative (-120009) 3. in pjsip_endpt_handle_events2 errno is queried again (through pj_get_netos_error()) and somehow has been changed to ETIMEDOUT in the meantime. What I am doing is having pj_ioqueue_unregister() called from a different thread than the select() is active in. This seems to confuse the select(). How is this supposed to work, since ioqueue->lock is released around the select() statement? Ruud Klaver AG Projects