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

Ensure synchronous handling does not block new requests and allow clearing SyncInfoCache #94

Merged
merged 1 commit into from
Dec 1, 2024

Conversation

jbrookssmokeball
Copy link
Contributor

There are two changes here:

  1. Fix issue TcpHost accepting new client synchronously when AcceptAsync returns false #46 where accepting TCP clients synchronously is blocking new clients from being accepted until the terminating request is received on the synchronous client.

    • I don't know of a reliable way to get AcceptAsync to return false, however it has happened in a production application a couple times and I am able to replicate it in a test application by continuously creating TcpClients until one connection is eventually handled synchronously by the host (and blocks all future connections).
  2. Allow the SyncInfoCache cache to be cleared.

    • We have a scenario in our application where the client needs to reconnect to the host after it updates, however the host may have changed services as part of the update. This causes the client's cached sync info to be out of date which may break some remote calls, so we need to clear it out and re-sync interfaces with the host. Currently we are using reflection to clear out this cache, so it would be nice to have a proper way to do this.

@jbrookssmokeball
Copy link
Contributor Author

Not sure why the ServiceWireTests.NpTests.ResponseParallelTest test is failling on Linux, but don't think it's related to this change🤔.

Anyway, here's the test program I mentioned to reproduce #46: ServiceWireBugTestForGitHub.zip

To run it:

  1. Build the solution.
  2. Run HostTest.exe - leave the console window open.
  3. Run ClientTest.exe - this will start sending requests to the host (10 requests in parallel, every 100ms).
  4. The host and client consoles will log requests/responses.

After running for a little while (on my machine anyway), the AcceptAsync function eventually returns false on one of the calls, which causes all future requests to hang (i.e. both console windows will stop outputting).

@tylerje tylerje merged commit 394cc5e into tylerjensen:master Dec 1, 2024
1 of 2 checks passed
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.

2 participants