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

Deadlock with HTTP server and client in one process #277

Open
domob1812 opened this issue Aug 12, 2019 · 1 comment
Open

Deadlock with HTTP server and client in one process #277

domob1812 opened this issue Aug 12, 2019 · 1 comment

Comments

@domob1812
Copy link
Contributor

According to my understanding, HttpServer creates multiple threads and listens with them detached from the main thread. And it should be possible to use multiple HttpClient's with a single server and concurrently. Is that correct?

I've created example code which starts a server and then does two "long" RPC calls from two separate threads to the server.

This sometimes (not always) results in a deadlock, where apparently only one of the calls is made and the other blocks before the server's method is called. In the example code, "Wait called" is then logged only once, and the code blocks until the HttpClient times out.

Is this a bug or expected behaviour? If the latter, what exactly is my example code doing wrong? Thanks a lot!

@domob1812
Copy link
Contributor Author

I've updated my gist now to further figure out what is happening. In the new version, the server is running in a separate process and each HttpClient and RPC client is only created and used from the thread that is doing the call.

I still see a deadlock sometimes on the client side. When that happens, the server is fine, and can be called just fine from another process. So this must be some bug (or error in my usage) of the HTTP client in libjson-rpc-cpp.

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

No branches or pull requests

1 participant