Hey, checking in. I know this is very late, but better late than never I guess... I do not see any problem and yes, that should work. Servers can handle multiple RPCs from the same client in parallel, including a streaming call. The client crash seems like a bug somewhere. If you can share code, we can help spot the bug. If instead it's a bug in gRPC, we will handle it at https://github.com/grpc/grpc/issues.
In the past year, we have also updated our docs on the APIs, please check them out as well. On Monday, September 26, 2022 at 1:14:56 AM UTC-7 Christophe Calmejane wrote: > Hi, > > is there something else I can add to clarify my issue? > Why would the client crash because of the server responding to 2 different > calls at the same time (or maybe something else is going on)? > > Thank you > > Le vendredi 16 septembre 2022 à 15:44:17 UTC+2, Christophe Calmejane a > écrit : > >> Hi, >> >> I'm experimenting gRPC in c++ and I'm not sure what I want to achieve is >> possible with the framework. >> >> I need: >> >> 1. a single connection btw the client and the server >> 2. the client to be able to send multiple requests to the server from >> different threads (sync or async is fine) >> 3. the server to be able to send messages to the client at any time >> (observer pattern) >> >> So what I implemented is the following: >> >> I declared a "registerObserver" RPC in my proto file, as well as some >> unary commands. >> >> On the server side (not in callback mode), when I receive the >> registerObserver command, I store the grpc::ServerWriter and don't return >> from the method until cancelled by the client. Whenever another server >> thread needs to send a message to the client, it just uses the stored >> ServerWriter. >> For the unary commands, I simply handle them inline and return the status >> immediately. >> >> On the client side, I created a grpc::ClientReadReactor to handle the >> stream of messages from the server, and sync/async calls for the unary >> commands my client wants the server to handle. >> >> So, it seems to be working nicely, except when the server writes 2 >> messages at the same time. Whether an actual write call using my stored >> ServerWriter, or an indirect write when I return a status in a unary >> handler. >> In such a case, the client always crashes in RunInterceptor. >> >> So my questions are: >> >> - is it even possible to have the server (and the client) handle >> multiple rpc from the same client in parallel, including a streaming call? >> - if yes, how to properly achieve this? >> >> >> Thanks for your insight, >> Chris >> > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/grpc-io/cf7bd6ff-334f-4d0d-b445-14e1242b5a39n%40googlegroups.com.