This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

poll() with POLLIN not set still getting hit

I'm trying to wait on a single POLLIN event on a net socket, but I'm finding that poll() will still return immediately with the POLLIN event even if it's not set in the struct pollfd.event bitfield. It'll keep doing this, too, until someone uses recv() to read the data. When there's no data -- both before doing something that causes incoming data and after a recv() -- poll() properly sits and waits in the kernel call.

Our code is using the "offloaded" socket setup, so I would think this behavior is a consequence of the nRF9160 co-processor's socket stack. Is this a known issue/intended behavior?

Parents
  • Actually, I take part of that back: the POLLIN bit appears to remain active even after reading in all of the data (allowed 576 bytes, read 368). It looks like revents isn't cleared by the poll() call, which is why it looked like the bit was continuing to be set. When I manually clear it between each poll() call, the bit doesn't show up the next time poll() exits, but poll() does still exit each time, which to me implies *something* is getting permanently stuck somewhere.

Reply
  • Actually, I take part of that back: the POLLIN bit appears to remain active even after reading in all of the data (allowed 576 bytes, read 368). It looks like revents isn't cleared by the poll() call, which is why it looked like the bit was continuing to be set. When I manually clear it between each poll() call, the bit doesn't show up the next time poll() exits, but poll() does still exit each time, which to me implies *something* is getting permanently stuck somewhere.

Children
No Data
Related