-
Notifications
You must be signed in to change notification settings - Fork 248
Description
Hi,
after much struggle, I was able to build the C++ API (see issue #825) on Windows.
I then created a very minimal C++ client to interact with our company's triton server (v2.55.0). The code is very straightforward:
#include <iostream>
#include <string>
#include "grpc_client.h"
#include "common.h"
namespace tc = triton::client;
int main()
{
const std::string url = "tritonserver.local:8001";
const std::string model_name = "testmodel";
const std::string model_version = "1";
std::unique_ptr<tc::InferenceServerGrpcClient> client;
auto err = tc::InferenceServerGrpcClient::Create(&client, url, false);
if (!err.IsOk())
std::cerr << "Unable to create client\n";
tc::Headers headers;
inference::ModelMetadataResponse model_metadata;
err = client->ModelMetadata(&model_metadata, model_name, model_version, headers);
if (!err.IsOk())
std::cerr << "unable to get model metadata\n";
}Compilation works without issues, but at runtime invoking client->ModelMetadata(...) results in a crash:
Exception thrown at 0x00007FFCBA9EEDE3 (grpcclient.dll) in triton_client.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
grpcclient.dll!google::protobuf::MessageLite::ParseFrom<1,google::protobuf::io::ZeroCopyInputStream *>(google::protobuf::io::ZeroCopyInputStream * const & input) Line 547 C++
grpcclient.dll!google::protobuf::MessageLite::ParseFromZeroCopyStream(google::protobuf::io::ZeroCopyInputStream * input) Line 261 C++
grpcclient.dll!grpc::GenericDeserializegrpc::ProtoBufferReader,google::protobuf::MessageLite(grpc::ByteBuffer * buffer, google::protobuf::MessageLite * msg) Line 84 C++
grpcclient.dll!grpc::SerializationTraitsgoogle::protobuf::MessageLite,void::Deserialize(grpc::ByteBuffer * buffer, google::protobuf::MessageLite * msg) Line 110 C++
grpcclient.dll!grpc::internal::CallOpRecvMessagegoogle::protobuf::MessageLite::FinishOp(bool * status) Line 447 C++
grpcclient.dll!grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata,grpc::internal::CallOpSendMessage,grpc::internal::CallOpRecvInitialMetadata,grpc::internal::CallOpRecvMessagegoogle::protobuf::MessageLite,grpc::internal::CallOpClientSendClose,grpc::internal::CallOpClientRecvStatus>::FinalizeResult(void * * tag, bool * status) Line 922 C++
grpcclient.dll!grpc::CompletionQueue::Pluck(grpc::internal::CompletionQueueTag * tag) Line 325 C++
grpcclient.dll!grpc::internal::BlockingUnaryCallImplgoogle::protobuf::MessageLite,google::protobuf::MessageLite::BlockingUnaryCallImplgoogle::protobuf::MessageLite,google::protobuf::MessageLite(grpc::ChannelInterface * channel, const grpc::internal::RpcMethod & method, grpc::ClientContext * context, const google::protobuf::MessageLite & request, google::protobuf::MessageLite * result) Line 88 C++
grpcclient.dll!grpc::internal::BlockingUnaryCallinference::ModelMetadataRequest,inference::ModelMetadataResponse,google::protobuf::MessageLite,google::protobuf::MessageLite(grpc::ChannelInterface * channel, const grpc::internal::RpcMethod & method, grpc::ClientContext * context, const inference::ModelMetadataRequest & request, inference::ModelMetadataResponse * result) Line 49 C++
grpcclient.dll!inference::GRPCInferenceService::Stub::ModelMetadata(grpc::ClientContext * context, const inference::ModelMetadataRequest & request, inference::ModelMetadataResponse * response) Line 169 C++
grpcclient.dll!triton::client::InferenceServerGrpcClient::ModelMetadata(inference::ModelMetadataResponse * model_metadata, const std::string & model_name, const std::string & model_version, const std::map<std::string,std::string,std::lessstd::string,std::allocator<std::pair<std::string const ,std::string>>> & headers, const unsigned __int64 timeout_ms) Line 642 C++
triton_client.exe!main() Line 23 C++
`
The C++ API was build using the following commands:
cmake -DVCPKG_TARGET_TRIPLET=x64-windows -DCMAKE_TOOLCHAIN_FILE='c:/vcpkg/scripts/buildsystems/vcpkg.cmake' -DCMAKE_INSTALL_PREFIX=install -DTRITON_ENABLE_CC_GRPC=ON -DTRITON_COMMON_REPO_TAG='r25.04' -DTRITON_THIRD_PARTY_REPO_TAG='r25.04' -DTRITON_CORE_REPO_TAG='r25.04' -DTRITON_VERSION='2.55.0' -DRAPIDJSON_INCLUDE_DIRS='C:/vcpkg/installed/x64-windows/include' -DRapidJSON_ROOT=' C:/vcpkg/installed/x64-windows/include' -DCMAKE_MODULE_PATH='C:/make_modules' ..
msbuild.exe cc-clients.vcxproj -p:Configuration=ReleasePlease note that the last few arguments to cmake were necessary to overcome the issue #825 , where I basically just force cmake to look in the right paths.