-
Notifications
You must be signed in to change notification settings - Fork 820
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
Segfault with C++ SDK #999
Comments
@devjgm are you able to have a look at this? |
I'm not sure if I have time to dig into this, but here are a few questions that'll help anyone who might look into this:
|
Trying to debug it with the local SDK server, I've found that the problem only happens when running in a Docker container. Here's a single file repro #include <memory>
#include <iostream>
#include <agones/sdk.h>
int main(int /*argc*/, char * /*argv*/ [])
{
std::cout << "Connecting to agones\n";
auto agones_sdk = std::make_shared<agones::SDK>();
if (!agones_sdk->Connect())
{
throw std::runtime_error("Could not connect to agones");
}
std::cout << "Connected to agones\n";
std::cout << "Marking server as ready\n";
grpc::Status ready_call_status = agones_sdk->Ready();
if (!ready_call_status.ok())
{
std::string error_message = "Could not mark server as ready: {}" + ready_call_status.error_message();
throw std::runtime_error(error_message);
}
grpc::Status shutdown_call_status = agones_sdk->Shutdown();
if (!shutdown_call_status.ok())
{
std::string error_message = "Could not mark server as shutdown: " + shutdown_call_status.error_message();
throw std::runtime_error(error_message);
}
return 0;
}
And here's the stack trace when it segfaults.
It's segfaulting on As I said in #1000, I'm going to try and make the REST API work (one less library to link against) so I wont be able to spend much time debugging this myself. But I have the commit with this problem in my history so if you do need any more info about this let me know. |
This may show my limited C++ knowledge, but what OS/arch are you compiling on, and what is your Docker base OS? |
It's okay, It's probably some silly mistake I'm making. Building in Docker on the gcc:9 image, and running on the ubuntu:19.04 image. Ubuntu 18.04 64 bit host OS, if that matters. |
Your single file repro looks quite similar to the cpp-simple example. The example builds with gcc:8 and runs on debian:stretch, so maybe there is some small difference there that is causing the issue. |
Doing some issue cleanup. Unless there are any objections, I'll close this issue in 3 days. |
Just tried the Dockerfile I was using before again, and can confirm the problem is gone in v1.1.0. |
I'm glad it's been fixed. :) |
What happened:
Using the C++ SDK, my application segfaults when trying to communicate with the sidecar.
What you expected to happen:
The application should return a
grpc::Status
object representing whether or not the call was successful.How to reproduce it (as minimally and precisely as possible):
Relevant code included below:
My health check function:
Anything else we need to know?:
The segmentation fault happens on
bool ok = agones_sdk->Health();
andgrpc::Status ready_call_status = agones_sdk->Ready();
, depending on which comes first I think. Here's the output of the above code.As we can see, the first health ping is sent okay, but it segfaults afterwards (segfaults aren't shown in
kubect logs
, but can be seen inkubectl describe
).cpp-simple
works, so I don't think it's an issue with the Kubernetes setup.Environment:
kubectl version
): v0.12.10The text was updated successfully, but these errors were encountered: