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

Prevent circular references #35

Open
ugwis opened this issue May 1, 2024 · 0 comments
Open

Prevent circular references #35

ugwis opened this issue May 1, 2024 · 0 comments
Labels
bug Unexpected behavior / Something isn't working

Comments

@ugwis
Copy link
Member

ugwis commented May 1, 2024

why

There is no mechanism to detect circular references, so incorrect references will cause stack overflows.

$ cat rec.yaml               
Diagram:
  Resources:
    Canvas:
      Type: AWS::Diagram::Canvas
      Direction: vertical
      Children:
        - Resource1
    Resource1:
      Type: AWS::Diagram::Group
      Children:
        - Resource2
    Resource2:
      Type: AWS::Diagram::Group
      Children:
        - Resource1
$ awsdac rec.yaml -v
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc0201e0390 stack=[0xc0201e0000, 0xc0401e0000]
fatal error: stack overflow

runtime stack:
runtime.throw({0xd4bf112?, 0x200000001?})
	/usr/local/Cellar/go/1.22.0/libexec/src/runtime/panic.go:1023 +0x5c fp=0x700009667d88 sp=0x700009667d58 pc=0xd23489c
runtime.newstack()
	/usr/local/Cellar/go/1.22.0/libexec/src/runtime/stack.go:1103 +0x5bd fp=0x700009667f38 sp=0x700009667d88 pc=0xd24fb5d
runtime.morestack()
	/usr/local/Cellar/go/1.22.0/libexec/src/runtime/asm_amd64.s:616 +0x7a fp=0x700009667f40 sp=0x700009667f38 pc=0xd2678fa

goroutine 1 gp=0xc000006380 m=4 mp=0xc000057b08 [running]:
runtime.convTstring({0x0?, 0x0?})
	/usr/local/Cellar/go/1.22.0/libexec/src/runtime/iface.go:388 +0x8c fp=0xc0201e03a0 sp=0xc0201e0398 pc=0xd20936c
github.com/awslabs/diagram-as-code/internal/types.(*Group).Scale(0xc0000ee500)

what

Detect and warn about circular resource references

@ugwis ugwis added the bug Unexpected behavior / Something isn't working label May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected behavior / Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant