Hi Frank, There can only be a single concurrent write at a time, so you need to wait until you see the TAG* of the previous write and then you can write again.
https://grpc.github.io/grpc/cpp/classgrpc_1_1internal_1_1_async_writer_interface.html#a03f8532dfbd6c82c7d1fed5bc6e79d79 On Thu, Jun 1, 2023 at 11:53 PM Frank Xie <frankxie2...@gmail.com> wrote: > Hi, > > I am new to gRPC. I am trying to follow the example code ( for some > unclosed reason, we have to use version gRPC v1.38), > at > https://github.com/grpc/grpc/blob/v1.38.x/examples/cpp/helloworld/greeter_async_server.cc > to implement an asynchronous gRPC server with extra complexity in that the > server will send multiple responses (aka, stream) to gRPC client. > > the proto is something like > > rpc MyRequest (ReqMsg) returns (stream RespMsg) > > Basically, when the gRPC server receive client request, it needs > *asynchronously* get the info from somewhere else. When the required info > comes back (via callback from a different thread, but multiple times), the > callback function then *write back* the response using the data structure > maintained in CallData,, aka, responder ,etc. During my testing, my gRPC > server crashes at proto_buffer_writer.h assertion failed > !byte_buffer->Valid() after writing back 2 or 3 responses. I am wondering > whether it is due to diff thread (other than the thread which block-waiting > on gRPC communication) is doing the writing. > > Any advice is appreciated. > > Frank > > -- > 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 on the web visit > https://groups.google.com/d/msgid/grpc-io/22e8fcef-d9eb-4b54-a3f7-2325ea2c3be5n%40googlegroups.com > <https://groups.google.com/d/msgid/grpc-io/22e8fcef-d9eb-4b54-a3f7-2325ea2c3be5n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- <https://lefty.io/> The influencer marketing platform for lifestyle brands CHRISTIAN RIVASSEAU CTO +33 6 67 35 26 74 lefty.io [image: LinkedIn] <https://www.linkedin.com/in/christian-rivasseau-556a054/> -- 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 on the web visit https://groups.google.com/d/msgid/grpc-io/CAJ6g4%3DZ2z2wN1YeCQX3Ns5-Eg0K%3D5OESwxU-ZvxCYQBz9RQ-bA%40mail.gmail.com.