frr icon indicating copy to clipboard operation
frr copied to clipboard

grpc call generate coredump

Open nanfengnan1 opened this issue 1 year ago • 1 comments

Description

i want to frr capabilities. write a grpc client call, but coredump.

Version

frr-10.0

How to reproduce

#include #include #include <grpc/grpc.h> #include <grpcpp/create_channel.h> #include "frr-northbound.pb.h" #include "frr-northbound.grpc.pb.h"

void get_capbilites_callback(grpc::Status status) { if (status.ok()) { std::cout << "RPC call succeeded!" << std::endl; } else { std::cout << "RPC call failed: " << status.error_message() << std::endl; } }

int main() { frr::GetRequest request; frr::GetResponse reply; grpc::ClientContext context; grpc::Status status;

/* 
 * grpc api: create a grpc channel for tcp connect 
 *      param1: ip:port pair
 *      param2: authentication credentials
 *              grpc::InsecureChannelCredentials: unsecurity connect
 *              grpc::SslCredentials: ssl/tll connect and recommand
 */
auto channel = grpc::CreateChannel("10.8.126.131:50051",
                                 grpc::InsecureChannelCredentials());
auto stub = frr::Northbound::NewStub(channel);

#if 0 request.set_type(frr::GetRequest::ALL); request.set_encoding(frr::XML); request.set_with_defaults(true); request.add_path("/frr-interface:lib"); auto stream = stub->Get(&context, request);

std::ostringstream ss;
while (stream->Read(&reply))
  ss << reply.data().data() << std::endl;

status = stream->Finish();
assert(status.ok());
std::cout << "Interface Info:\n" << ss.str() << std::endl;

std::cout << "service name: " << frr::Northbound::service_full_name() << std::endl;

std::cout << "" << std::endl;^

#endif

frr::CreateCandidateRequest req_candidate;
frr::CreateCandidateResponse res_candidate;

status = stub->CreateCandidate(&context, req_candidate, &res_candidate);

assert(status.ok());
printf("create candidate, id: %u\n", res_candidate.candidate_id());


frr::GetCapabilitiesRequest req_cap;
frr::GetCapabilitiesResponse res_cap;

req_cap.InitAsDefaultInstance();

stub->GetCapabilities(&context, req_cap, &res_cap);

printf("frr_version: \"%s\"\n", res_cap.frr_version());
printf("support modules: %ld\n", res_cap.supported_modules_size());
printf("rollback_support: %d\n", res_cap.rollback_support());

}

g++ nrth_cpp_client.cc frr-northbound.grpc.pb.cc frr-northbound.pb.cc -o nrth_cpp_client -lgrpc++ -lprotobuf

Expected behavior

x

Actual behavior

callback stack: [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `./nrth_cpp_client'. Program terminated with signal SIGABRT, Aborted. #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. [Current thread is 1 (Thread 0x7f07e2847240 (LWP 17649))] (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007f07e2e76859 in __GI_abort () at abort.c:79 #2 0x00007f07e351c273 in ?? () from /lib/x86_64-linux-gnu/libgrpc++.so.1 #3 0x00007f07e3522ce5 in grpc::Channel::CreateCall(grpc::internal::RpcMethod const&, grpc::ClientContext*, grpc::CompletionQueue*) () from /lib/x86_64-linux-gnu/libgrpc++.so.1 #4 0x000055c16f7f74e9 in grpc::internal::BlockingUnaryCallImpl<frr::GetCapabilitiesRequest, frr::GetCapabilitiesResponse>::BlockingUnaryCallImpl(grpc::ChannelInterface*, grpc::internal::RpcMethod const&, grpc::ClientContext*, frr::GetCapabilitiesRequest const&, frr::GetCapabilitiesResponse*) () #5 0x000055c16f7f2706 in grpc::Status grpc::internal::BlockingUnaryCall<frr::GetCapabilitiesRequest, frr::GetCapabilitiesResponse>(grpc::ChannelInterface*, grpc::internal::RpcMethod const&, grpc::ClientContext*, frr::GetCapabilitiesRequest const&, frr::GetCapabilitiesResponse*) () #6 0x000055c16f7eb235 in frr::Northbound::Stub::GetCapabilities(grpc::ClientContext*, frr::GetCapabilitiesRequest const&, frr::GetCapabilitiesResponse*) () #7 0x000055c16f7ea210 in main ()

hope to okay. i want to know if my function call error. hope to how to use frr grpc function call.

Additional context

x

Checklist

  • [X] I have searched the open issues for this bug.
  • [X] I have not included sensitive information in this report.

nanfengnan1 avatar Jun 26 '24 13:06 nanfengnan1

i did't start sqlite3 database.

nanfengnan1 avatar Jun 27 '24 01:06 nanfengnan1

This issue is stale because it has been open 180 days with no activity. Comment or remove the autoclose label in order to avoid having this issue closed.

github-actions[bot] avatar Dec 24 '24 01:12 github-actions[bot]

This issue will be automatically closed in the specified period unless there is further activity.

frrbot[bot] avatar Dec 24 '24 01:12 frrbot[bot]