LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   select() waking up with rd_set on a not yet connected socket. (https://www.linuxquestions.org/questions/programming-9/select-waking-up-with-rd_set-on-a-not-yet-connected-socket-816191/)

jork 06-24-2010 03:28 PM

select() waking up with rd_set on a not yet connected socket.
 
I'm facing a strange problem with our code. What the program does is to wait on a select() after a non-blocking connect. And I expect the select wake up with write_set after the ESTAB. And I expect select wakeup with both rd_set and wr_set if I recv a RST back for our SYN or any similar errors. But in one of the cases I'm seeing select is waking up with only rd_set in a non-connected sockeet, which is causing a lot of problems for me.

The code is organized such that the socket close() happens only in wr_set processing. Because of that with the above problem I'm going in to a strange scenario. After the event I call select() again and wait for another socket event. But with this issue, my select is waking up there after everytime as soon as I call select(). That too only with rd_set. So it keeps on going with select() sleeping 0 secs. Thus the program is hung and eating lot of CPU cycles also.

The trigger for all these problems seems to be some event which causes the waking up of select() with rd_set only. I tried many ways to find out what is happening with this. Couldn't find anything interesting yet. Anyhelp on this would be highly appreciated.

Thanks,
jork

jschiwal 07-19-2010 05:22 AM

Moved: This thread is more suitable in Programing and has been moved accordingly to help your question get the exposure it deserves.


All times are GMT -5. The time now is 11:56 AM.