Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix IpcOneShotServer for `inprocess` backend #90
Conversation
|
I tested this by forcing the |
|
|
Looks like the test failure happens on mac. |
|
Actually, I am surprised that it didn't fail on the GNU/Linux builder: it turns out this test case fails on my system when using the Linux backend. (I forgot to try that before...) It seems I made a wrong assumption about how |
|
|
Holding a global lock on the `ONE_SHOT_SERVERS` map while doing the blocking `accept()` invocation is a very bad idea -- aside from possible long-range concurrency problems or deadlocks, it actually creates a race condition between `accept()` and `connect()`, which the existing test case triggers pretty much every time on my system. The solution used here is not the most elegant IMHO -- but it's the only one I can think of that preserves the current abstraction, with `accept()` and `connect()` methods on `ServerRecord`. Possible more elegant (but also way more invasive) solutions would be moving the `conn_receiver` (along with the `accept()` implementation) to `OsIpcOneShotServer`; or even keeping *only* `conn_receiver` in `OsIpcOneShotServer`, while the actual data channel is only created and sent over the connect channel in the connect/accept phase -- thus bringing it more in line with the socket implementation...
With the deadlock in the `inprocess` implementation fixed, this should work fine on Windows now.
…ect()` Invoking `accept()` after `connect()` used to fail, because the server record was being dropped while doing the `connect()`. Now dropping it after the `accept()` instead -- which is safe for either invocation order, because `accept()` is blocking, and thus never finishes before `connect()` is done. Also adding a separate `server_connect_first` test case to explicitly test this situation. (And modifying the original test case to ensure it always tests the other situation.)
530b99b
to
40b42a4
|
Looks better now. I also implemented an alternate approach, using a |
|
|
|
Looks good once conflicts are resolved. Sorry about the delay! |
antrik commentedAug 1, 2016
Several patches covering individual aspects, each fixing one possible situation that was broken.
(I don't think there was actually any situation that was working correctly before...)