-
Notifications
You must be signed in to change notification settings - Fork 21
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
conmand takes a long time until connecting to a newly created UNIX socket #28
Comments
Just a quick ack... I'm hoping to have time to look at this next week. |
Thanks, Chris!
|
Thanks for taking the time to run this down and write-up a detailed analysis. I wasn't able to reproduce this with netcat as you show, so I wrote a little server where I could introduce various delays to trigger it. I restructured things a bit in 138e1e2 (uds-connect-via-inotify-fails). It passes my testing. Can you look at it to make sure it works in your setup, and that you're ok with the changes I made? BTW, the max timeout for UNIX domain socket connections is 60s. Still, that's a long time to wait when you're triggered by inotify. |
Thanks for looking into this. I believe I found out why you are not seeing this issue with the simple test case above - and I should have thought about this earlier: the VM I've been using for testing was just single socket/core. After increasing the number of cores, the problem did not show most of the time. For reference, let me attache the Single CPU
From the time stamps one sees that Multiple CPUs
Here it is pretty obvious that conmand and netcat are running on different cores so that the former doesn't get scheduled away to schedule the latter to notify it of the event. I will grab your updated fix and test it here. Thanks for looking into this! |
Thanks for the fix - I've tested it: it works - of course! |
Whoops... I forgot to reset the flag in I was thinking the state variable approach would be a bit easier to follow. I'll try to tag a release in the next couple of weeks to get this fix out. There's a bit of cleanup I'd like to do if I can set aside some time. |
@dun Chris, thanks for taking care of this! |
@e4t I'll get this in the next release. I'm in the process of cleaning the old autoconf cruft. I'm planning to tag & test once that's done. Thanks again for your PR. |
@chris, thanks for letting me know - I've just pushed the patch into a maintenance update for SUSE SLES/ openSUSE Leap. |
I expect to release by Sep 15. That should give me ample time yet, but I've had to deal with other issues this past week that are still ongoing. The only thing going into this release besides your patch is the autotools cleanup. |
@e4t: My autotools cleanup isn't quite ready, so it'll have to wait 'til next time. I've just released 0.3.0 with your patch. Thanks for your patience. |
Thanks for letting me know, Chris! Will update the package ASAP. |
If a UNIX socket is created after conmand has started there may be a long delay until it connects to it.
Conmand watches for the appearance of new sockets using inotify, however, inotify triggers (and causes poll() to return) when the side creating the socket has bind()ed to the socket. At this time it is yet possible to connect() - this will not happen until the other side calls listen(). Thus the connect() after being invoked by inotify will most likely fail and conmand will return to poll() waiting for further events or a timeout. The timeouts are increased each time they are triggered up to a maximum of 3 minutes currently.
The text was updated successfully, but these errors were encountered: