Hey!
I'm implementing a system in which the services communicate with each other via gRPC. I figured that I could just spawn a client inside of the server to talk to another server. Unfortunately, this solution failed for multiple simultaneous connections.
What I mean is, I have: client, service1, service2.
How it works:
- client makes a connection to service1 and sends data,
- service1 makes a connection to service2 and sends data,
- service1 waits until service2 finishes processing data,
- service2 terminates the connection with service1
- service1 terminates the connection with client
I'm using gRPC's reactors and the async API.
The problem: When I spawn 2 simultaneous connections from the client, the flow hangs in different places (it's not always the same place).
QUESTIONS
- Is the system properly designed (with the client spawned on the server)?
- Is there an example of something like that maybe somewhere?
- Has such a scenario (or similar) been considered by the authors of the gRPC?
- Are there any known issues/pitfalls when doing something like this? Maybe I missed setting something in the connection's config?
- Is it possible that the gRPC has not been designed to handle such scenarios? I'm having a hard time finding out whether the problem lies in my logic or in a library I use.
Thank you in advance!