Opened 2 years ago

Last modified 13 months ago

#18327 closed bug

select() does not report disconnect events — at Version 3

Reported by: LekKit Owned by: axeld
Priority: normal Milestone: R1/beta5
Component: Network & Internet/TCP Version: R1/beta4
Keywords: select, tcp, network Cc:
Blocked By: Blocking:
Platform: All

Description (last modified by LekKit)

When another end of the TCP socket is closed, select() should report that in rfds set. It doesn't as of hrev56862, and doesn't wake from blocking either. This prevents any software using select() from tracking disconnect events, and freeing clients appropriately.

Attached a tiny program that reproduces this. On systems susceptible to the bug it'd hang and never exit.

Update: The poll() facility is subject to this bug as well, i.e. listening for POLLIN | POLLERR | POLLHUP never notices a HUP event.

Update (2): Haiku-specific API wait_for_objects() from <OS.h> also hangs.

Change History (5)

by LekKit, 2 years ago

Attachment: haiku_select_repro.c added

Reproduces the issue

comment:1 by LekKit, 2 years ago

Description: modified (diff)

by LekKit, 2 years ago

Attachment: haiku_poll_repro.c added

Reproduction, poll() variant

comment:2 by LekKit, 2 years ago

Confirmed to hang on slightly older hrev56578 install as well.

Last edited 2 years ago by LekKit (previous) (diff)

comment:3 by LekKit, 2 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.