Yaak Logo
Yaak
Feedback/Crash when parsing gRPC schemas

Crash when parsing gRPC schemas

Arnaud Barisain-Monrose·a year ago
ReleasedBug

When I enter one of our internal gRPC server’s address in the endpoint field, Yaak instantly crashes and can’t be relaunched without crashing unless I clear its data.

I narrowed down the issue to a stack overflow “json_schema::message_to_json_schema”. If I comment out

properties.insert(f.name().to_string(), message_to_json_schema(pool, m));

then it doesn’t crash anymore.

Adding some logs show that it gets stuck in one of the many places where our protobuf messages have circular references

eg:

message Item {
 oneof typeditem {
   ArrayItem foo;
 }
}

message ArrayItem {
 //...
 Item previous;
}

I am not submitting a PR because I don’t know how to really fix this instead of just breaking the schema paring feature.

Have a nice day,

Mac

Comments (12)

Sign in to leave a comment.

Hao Xiang

try to fix by #194

Arnaud Barisain-MonroseOP

thanks.

I tried it out and it’s stuck on “inspecting schema”, which means I can’t pick a method.

Hao Xiang

Do you mean that you built #194 locally, but it still doesn't work?

Arnaud Barisain-MonroseOP

Yes! It doesn’t crash but it’s not really working either: it’s stuck on waiting for reflection, I can’t even import my protos manually.

Hao Xiang

Thanks your reply. I made some update again. And I have tested it with the proto below. If it doesn’t work yet, let me know.

syntax = "proto3";

package helloworld;

import "google/api/annotations.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/any.proto";
import "google/protobuf/descriptor.proto";

option go_package = "go-zero/grpc_reflection/proto/helloworld/helloworld";
option java_multiple_files = true;
option java_outer_classname = "HelloWorldProto";
option java_package = "io.grpc.examples.helloworld";

service Greeter {

  rpc MessageTypeEnumerate(FullTypeMessage) returns (FullTypeMessage){
    option (google.api.http) = {
      post: "/v1/example/echo"
      body: "*"
    };
  };
}

message FullTypeMessage{
  message NestedMessage {
    bytes one = 1; // scalar
  }

  // basic
  int32 one = 1; // scalar
  Person two = 2; // custom message
  // with cardinality
  repeated int32 three = 3; // repeated scalar
  repeated string four = 4; // repeated scalar
  repeated Person five = 5; // repeated custom message
  repeated OneofMessage six = 6; // repeated oneof message

  optional int32 seven = 7; // optional scalar
  optional string eight = 8; // optional scalar
  optional Person nine = 9; // optional custom message
  optional OneofMessage ten = 10; // optional oneof message

  // required int32 eleven = 11; // required scalar
  // required string twelve = 12; // required scalar
  // required Person thirteen = 13; // required custom message
  // required OneofMessage fourteen = 14; // required oneof message

  // map
  map<string, string> fifteen = 15; // scalar type map
  map<string, Person> sixteen = 16; // custom message map
  map<string, OneofMessage> seventeen = 17; // oneof message map

  NestedMessage eighteen = 18; // nested message
  google.protobuf.Any nighteen = 19; // import message
}

message OneofMessage{
  string which = 1;
  // onof
  oneof oneof_message {
    Person person = 2;
    CycleMessage Cycle = 3;
  }
}

message Person{
  enum Gender{
    UNKNOWN = 0;
    MALE = 1;
    FEMALE = 2;
  }

  string id = 1; // scalar
  string name = 2; // scalar
  int32 age = 3;
  Gender gender = 4; // enum
}

message CycleMessage{
  string id = 1;
  OneofMessage cycle = 2; // oneof
}

Arnaud Barisain-MonroseOP

Hey,

Thanks. Have you pushed the branch? The latest commit on the PR is from March 27 (

7cd3b8f2e3485ba09d1f0cbbb2435af213c40e80)

Gregory Schier

Thanks for the fix here! I will get the PR merged for the next release

Gregory Schier
Gregory Schier
Gregory Schier
Type to search feedback...