Skip to content

Stack overflow when reflecting mutually-referential messages #61

@zhihuizhang17

Description

@zhihuizhang17

Summary
When a proto file defines multiple messages that reference each other (e.g., request/response pairs), asking the reflection server to describe one of those messages
eventually crashes with a stack overflow. The reflection builder currently emits one pseudo proto file per message. For two messages in the same source file that depend on each other, the client chases an endless loop of FileByFilename lookups between the synthetic files and never settles.

Steps to Reproduce

  1. Edit examples/helloworld_v3/priv/protos/helloworld.proto and ensure HelloRequest references another message in that file—for example add google.protobuf.Struct
    struct = 2;. (This mirrors the scenario where two messages in one proto depend on each other or on a shared nested type.)
  2. Regenerate the Elixir stubs so the updated proto is reflected in the .pb.ex files.
  3. Start the reflection server then call it (use grpcurl: grpcurl -plaintext localhost:50051 describe .helloworld.HelloRequest).
  4. Observe the client output with runtime: stack overflow. The captured stack trace is in result.txt.

result.txt

Expected Behaviour
Asking for file_containing_symbol (or file_by_filename) should return the real proto (helloworld.proto) once, listing both HelloRequest and HelloReply in message_type with a finite dependency list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions