Skip to content

Conversation

mjheilmann
Copy link
Collaborator

While building the reflection tree, the build resolution can get stuck in a loop with messages that refer to each-other.

The root cause is that we didn't check if we already had added the field symbol to the state before processing it. Adding this check prevents the recursion problem and allows the build to complete the tree.


assert tree.files |> Map.keys() |> Enum.sort() == [
"recursive_message.Reply.proto",
"recursive_message.Request.proto",
Copy link
Contributor

@zhihuizhang17 zhihuizhang17 Oct 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix works for the server side but not the client side. This approach still generates separate files (recursive_message.Request.proto, recursive_message.Reply.proto), even though both messages live in the same source proto. Reflection clients (grpcurl, the Go reflection client, etc.) follow the dependency list, so they’ll bounce back and forth between those synthetic files forever and never resolve the request. In practice that means a FileByFilename loop and eventually a stack overflow—the exact failure we’re trying to eliminate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the clients are relying on protocol not supporting circular dependencies, so they don't cover it. Interesting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants