Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grpc call generate coredump #16298

Closed
2 tasks done
nanfengnan1 opened this issue Jun 26, 2024 · 3 comments
Closed
2 tasks done

grpc call generate coredump #16298

nanfengnan1 opened this issue Jun 26, 2024 · 3 comments
Labels
triage Needs further investigation

Comments

@nanfengnan1
Copy link

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

  • I have searched the open issues for this bug.
  • I have not included sensitive information in this report.
@nanfengnan1 nanfengnan1 added the triage Needs further investigation label Jun 26, 2024
@nanfengnan1
Copy link
Author

i did't start sqlite3 database.

Copy link

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.

@frrbot
Copy link

frrbot bot commented Dec 24, 2024

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

@frrbot frrbot bot closed this as completed Dec 31, 2024
@frrbot frrbot bot closed this as completed Dec 31, 2024
@frrbot frrbot bot removed autoclose labels Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs further investigation
Projects
None yet
Development

No branches or pull requests

1 participant