Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavioral change of shutdown() in Linux > 6.1.32 #493

Closed
rlebeau opened this issue Jul 19, 2023 · 2 comments
Closed

Behavioral change of shutdown() in Linux > 6.1.32 #493

rlebeau opened this issue Jul 19, 2023 · 2 comments
Labels
Element: Operating System Issues related to specific Operating Systems Element: Socket Stacks Issues related to OS socket APIs, TIdStack and TIdSocketList descedants, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Status: Completed Issue has been closed, no further work needed Type: Maintenance Issue is proposing maintenance of existing code

Comments

@rlebeau
Copy link
Member

rlebeau commented Jul 19, 2023

Apparently, a recent change in Linux now prevents one thread from disconnecting a TCP socket if other threads are waiting on the socket!

This does not bode well for Indy, which expects to be able to shutdown/close a TCP socket while threads are blocked on socket I/O operations. For #3 and #491, this change means that using connect() in non-blocking mode now becomes more important, otherwise ConnectTimeout becomes useless as a blocked connect() will no longer unblock when shutdown() is called.

Need to review if other socket functions now have potential problems introduced by this change in behavior.

@rlebeau rlebeau added Element: Socket Stacks Issues related to OS socket APIs, TIdStack and TIdSocketList descedants, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Status: Review Needed Issue needs further review to decide next status Type: Maintenance Issue is proposing maintenance of existing code Element: Operating System Issues related to specific Operating Systems labels Jul 19, 2023
@rlebeau rlebeau added this to the Indy 11 - Maintenance Release milestone Jul 19, 2023
@kralo
Copy link

kralo commented Oct 24, 2023

judging only by reading, have not tested yet, this linux commit ("tcp: allow again tcp_disconnect() when threads are waiting") torvalds/linux@419ce13 might make changes obsolete. Looks like .NET also depended on it

@rlebeau
Copy link
Member Author

rlebeau commented Oct 24, 2023

Even so, changing Indy to handle connects with timeouts better still has merit. But there are other aspects of Indy that would still be affected by this Linux behavior, such as TIdTCPServer shutting down while its client threads are blocked on pending reads. So hopefully this reversal in Linux's behavior will preserve that ability.

@rlebeau rlebeau closed this as completed Nov 24, 2023
@rlebeau rlebeau added Status: Completed Issue has been closed, no further work needed and removed Status: Review Needed Issue needs further review to decide next status labels Dec 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Element: Operating System Issues related to specific Operating Systems Element: Socket Stacks Issues related to OS socket APIs, TIdStack and TIdSocketList descedants, etc Element: TCP Issues related to TCP handling, TIdTCPClient and TIdTCPServer descendants, etc Status: Completed Issue has been closed, no further work needed Type: Maintenance Issue is proposing maintenance of existing code
Projects
None yet
Development

No branches or pull requests

2 participants