Hi, Please take a look at 
https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md for information 
on how to get more detailed logging. 

If something in gRPC triggered the socket closure, you might see some more 
details in the logs. This might also be a case where gRPC did not do a good 
job of propagating the real error, and if that's the case, please raise an 
issue at https://github.com/grpc/grpc/. On the other hand, if this is 
something that was caused by a network failure or remote trouble, gRPC logs 
won't be able to tell you much.

On Friday, March 21, 2025 at 8:26:04 AM UTC-7 Konstantina Skovola wrote:

> Hi!
>
> I am using the grpc c++ async callback API for my application and I don't 
> know how to get more details about the following error:
>
> On the server side I write the streaming response like this:
>
> ```
> cta::xrd::Response *header = new cta::xrd::Response();
> header->set_type(cta::xrd::Response::RSP_SUCCESS);
> header->set_show_header(cta::admin::HeaderType::TAPE_LS);
> response.set_allocated_header(header); // now the message takes ownership 
> of the allocated object, we don't need to free header
>
> std::cout << "about to call StartWrite on the server side" << std::endl;
> StartWrite(&response); // this will trigger OnWriteDone
> std::cout << "called StartWrite on the server" << std::endl;
> ```
>
> On the client side, I make the call like this
> ```
> std::cout << "In CtaAdminClientReadReactor, about to call the async 
> GenericAdminStream" << std::endl;
> client_stub->async()->GenericAdminStream(&m_context, request, this);
> std::cout << "Started the request to the server by calling 
> GenericAdminStream" << std::endl;
> StartRead(&m_response); // where to store the received response?
> std::cout << "In CtaAdminClientReadReactor, called startRead" << std::endl;
> StartCall(); // activate the RPC!
> std::cout << "In CtaAdminClientReadReactor, called StartCall()" << 
> std::endl;
> ```
>
> and then read the streaming response:
>
> ```
> virtual void OnReadDone(bool ok) override {
>         std::cout << "In CtaAdminCmdStream, inside OnReadDone() " << 
> std::endl;
>         if (!ok) {
>             std::cout << "Something went wrong with reading the response 
> in the client" << std::endl;
>         } else {
>             // if this is the header, print the formatted header
>             if (m_response.has_header()) {
>                 std::cout << "We received the header on the client side " 
> << std::endl;
>                 switch (m_response.header().type()) {
> .......
> ```
>
> Using debug prints, from the output, I can see that on the server side, 
> StartWrite() is called just once, then on the client side, the first time 
> OnReadDone is called, it goes into the “not ok” branch.
>
> The error code and message the rpc returns is “Error code: 14, Error 
> message: Socket closed”.
>
> How can I get more insights on where things go wrong? I have enabled debug 
> logging but it seems not much is logged by the async callback API.
>
> Any pointers will be greatly appreciated!
> Many thanks,
> Konstantina
>

-- 
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/fb2cc889-a9d7-4f4c-bc46-951bb6845af4n%40googlegroups.com.

Reply via email to