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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

somtin
Copy link

@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
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
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

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