Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive protobuf schema causes stackoverflow #76

Closed
lukas-mertens opened this issue Feb 17, 2024 · 4 comments · Fixed by #77
Closed

Recursive protobuf schema causes stackoverflow #76

lukas-mertens opened this issue Feb 17, 2024 · 4 comments · Fixed by #77
Assignees
Labels
bug Something isn't working released

Comments

@lukas-mertens
Copy link

Describe the bug

Recursive messages cause stackoverflow.

How to Reproduce

Define a protobuf schema with a recursion, e.g.

asyncapi: 3.0.0
info:
  title: Account Service
  version: 1.0.0
  description: This service is in charge of processing user signups
channels:
  userSignedup:
    address: user/signedup
    messages:
      UserSignedUp:
        $ref: '#/components/messages/UserSignedUp'
operations:
  sendUserSignedup:
    action: send
    channel:
      $ref: '#/channels/userSignedup'
    messages:
      - $ref: '#/channels/userSignedup/messages/UserSignedUp'
components:
  messages:
    UserSignedUp:
      payload:
        schemaFormat: application/vnd.google.protobuf;version=3
        schema: |
          syntax = "proto3";
          package Example;

          message A {
            string something = 1;
            repeated A recursive = 2;
          }

It will throw a Error thrown during AsyncAPI document parsing. Name: RangeError, message: Maximum call stack size exceeded, stack: RangeError: Maximum call stack size exceeded\n at Type.lookupTypeOrEnum

Expected behavior

Don't break. Even if it means recursive functions are not displayed properly in the generated docs, but it shouldn't make an asyncapi definition unusable, because certain things require such recursive protobuf messages

@lukas-mertens lukas-mertens added the bug Something isn't working label Feb 17, 2024
Copy link

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@GreenRover GreenRover self-assigned this Feb 17, 2024
@GreenRover
Copy link
Collaborator

GreenRover commented Feb 17, 2024

Your example will now parsed like:
Snag_4f99952

After #77 is merged

@lukas-mertens
Copy link
Author

@GreenRover Thanks a lot!

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 3.2.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants