Skip to content

Fixed notify happening before association is added to accept queue#273

Open
somtin wants to merge 1 commit intosctplab:masterfrom
cjswright:master
Open

Fixed notify happening before association is added to accept queue#273
somtin wants to merge 1 commit intosctplab:masterfrom
cjswright:master

Conversation

@somtin
Copy link
Copy Markdown

@somtin somtin commented Oct 25, 2018

When the server socket is operating in non-blocking mode, we wait for
the COMM_UP notification, and then call accept. However, the
association is not added to the accept queue until after the COMM_UP
notification is triggered. This causes the application to have to wait an
indeterminate amount of time and can cause race conditions when the
application calls accept before usrSCTP adds the association to the
accept queue.

The association is not added to the accept queue until after the
COMM_UP notification is triggered. This causes the application to have
to wait an indeterminate amount of time and can cause race conditions
when the application calls accept before usrSCTP adds the association
to the accept queue.
@tuexen
Copy link
Copy Markdown
Member

tuexen commented Oct 26, 2018

Could you provide a minimal test program which doesn't work before you change and does work after it?

@somtin
Copy link
Copy Markdown
Author

somtin commented Oct 26, 2018

I'm working on something else currently, but if I can find some time I'll do that. Not sure how long that'll be though.

@cjswright
Copy link
Copy Markdown

Hi @tuexen ... Apologies for the delay. I've created an example using the ekr example program. unzip and replace ekr_server.c, and run the server and client as normal. With the sleep, it spams the console with "usrsctp_accept: Resource temporarily unavailable" until the function returns and adds the association to the accept queue. Without the sleep, it depends on when the OS schedules the main thread to run - sometimes it fails until the second try, sometimes it works.

ekr_server.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants