{"action":"closed","issue":{"url":"https://api.github.com/repos/grpc/grpc/issues/3274","labels_url":"https://api.github.com/repos/grpc/grpc/issues/3274/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc/issues/3274/comments","events_url":"https://api.github.com/repos/grpc/grpc/issues/3274/events","html_url":"https://github.com/grpc/grpc/issues/3274","id":105272983,"number":3274,"title":"Hitting problem with Windows greeter_async_client code","user":{"login":"swingfield","id":3903455,"avatar_url":"https://avatars.githubusercontent.com/u/3903455?v=3","gravatar_id":"","url":"https://api.github.com/users/swingfield","html_url":"https://github.com/swingfield","followers_url":"https://api.github.com/users/swingfield/followers","following_url":"https://api.github.com/users/swingfield/following{/other_user}","gists_url":"https://api.github.com/users/swingfield/gists{/gist_id}","starred_url":"https://api.github.com/users/swingfield/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swingfield/subscriptions","organizations_url":"https://api.github.com/users/swingfield/orgs","repos_url":"https://api.github.com/users/swingfield/repos","events_url":"https://api.github.com/users/swingfield/events{/privacy}","received_events_url":"https://api.github.com/users/swingfield/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-09-07T22:28:24Z","updated_at":"2015-09-08T21:54:29Z","closed_at":"2015-09-08T21:54:29Z","body":"Hi there,\r\n\r\nI'm trying out the C++ client and server code on Windows. But I'm getting an access violation when running the client code.\r\n\r\nQuick rundown of what I've got and how I got there, in case I've missed something:\r\n\r\nI have helloworld server & client projects in VS2013. I used info from the README.MD at\r\n\r\nhttps://github.com/grpc/grpc/tree/master/vsprojects\r\n\r\nand some additional hints from \r\n\r\nhttps://github.com/grpc/grpc-common/issues/173\r\n\r\nto work towards getting the example over at\r\n\r\nhttps://github.com/grpc/grpc/tree/master/examples/cpp\r\n\r\nworking.\r\n\r\nAt first I ended up with non-async versions of greeter_client.cc & greeter_server.cc.  This version of the server failed, complaining that the completion queue vector was empty.  Doing some looking around the code base, I now realize this is probably expected, and I soon found the pre-supplied greeter_async_client/server.cc files.  I swapped my two non-async versions of these files with the async versions, and the server then started fine.\r\n\r\nHowever, when I run the client I get an access violation with a null pointer. \r\n\r\nPerhaps this is because I did not generate the greeter_async_client.cc file myself, but instead used the one I found in the code base as-is?  If this is the problem, could you tell me how to generate the async versions of the files via protoc.exe? \r\n\r\nIf it's helpful, here's additional information on the access violation I received.  It stemmed from CallOpSendInitialMetadata::SendInitialMetadata.  I might be wrong, but It looks like the method is being passed metadata which is a std:_Tree with a null _Myhead, and when it begins traversing the tree it hits the access violation.\r\n\r\nI'll add some screenshots here to hopefully give some context, along with the greeter_async_client.cc code.\r\n\r\nThanks in advance for any help.\r\n\r\n![image](https://cloud.githubusercontent.com/assets/3903455/9723322/ea4bc01a-557b-11e5-944e-290dde45e5da.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/3903455/9723330/fd25def0-557b-11e5-8267-769a55bbb00f.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/3903455/9723332/0649800e-557c-11e5-9607-ab8bbefb97b5.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/3903455/9723335/0c522ba4-557c-11e5-9b46-23db2ac37e86.png)\r\n\r\n\r\n```\r\nclass GreeterClient {\r\n public:\r\n  explicit GreeterClient(std::shared_ptr<Channel> channel)\r\n      : stub_(Greeter::NewStub(channel)) {}\r\n\r\n  std::string SayHello(const std::string& user) {\r\n    HelloRequest request;\r\n    request.set_name(user);\r\n    HelloReply reply;\r\n    ClientContext context;\r\n    CompletionQueue cq;\r\n    Status status;\r\n\r\n    std::unique_ptr<ClientAsyncResponseReader<HelloReply> > rpc(\r\n        stub_->AsyncSayHello(&context, request, &cq));\r\n    rpc->Finish(&reply, &status, (void*)1);\r\n    void* got_tag;\r\n    bool ok = false;\r\n    cq.Next(&got_tag, &ok);\r\n    GPR_ASSERT(ok);\r\n    GPR_ASSERT(got_tag == (void*)1);\r\n\r\n    if (status.ok()) {\r\n      return reply.message();\r\n    } else {\r\n      return \"Rpc failed\";\r\n    }\r\n  }\r\n\r\n private:\r\n  std::unique_ptr<Greeter::Stub> stub_;\r\n};\r\n\r\nint main(int argc, char** argv) {\r\n  GreeterClient greeter(grpc::CreateChannel(\r\n      \"localhost:50051\", grpc::InsecureCredentials()));\r\n  std::string user(\"world\");\r\n  std::string reply = greeter.SayHello(user);\r\n  std::cout << \"Greeter received: \" << reply << std::endl;\r\n\r\n  return 0;\r\n}\r\n```\r\n"}}