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

type unification of hcloud type(s) in HetznerRes #684

Closed
JefMasereel opened this issue Nov 25, 2021 · 3 comments · Fixed by #685
Closed

type unification of hcloud type(s) in HetznerRes #684

JefMasereel opened this issue Nov 25, 2021 · 3 comments · Fixed by #685

Comments

@JefMasereel
Copy link
Contributor

Versions:

  • mgmt version: 0.0.22-19-gf7271de-dirty (built from PR#681)

  • operating system/distribution: 5.15.4-arch1-1 x86_64 GNU/Linux

  • golang version: go1.17.3 linux/amd64

Description:

The mgmt binary was built from PR #681 on 23/11/2021, without any alterations from the official PR at that time. I wrote hetznertest.mcl for a first test, which is provided in the latest commit.

While testing the new hetzner resource with a small .mcl file, mgmt runs into a stack overflow issue. I discussed this with @purpleidea, and the problem appears to be an infinite recursion during type unification, starting from the HetznerRes.serverconfig field. The error message is shown below.

The serverconfig field is of type *hcloud.ServerCreateOpts, which is a rather convoluted struct containing all the information the hcloud client requires to create a new server via the cloud API. For now, it can be removed from the private fields in order to fix this issue, but it would be good to look into a stable solution eventually.

Hetzner-related documentation can be found at

$ ./mgmt run lang examples/lang/hetznertest.mcl 
2021/11/25 10:07:38 cli: lang: lexing/parsing...
2021/11/25 10:07:38 cli: lang: init...
2021/11/25 10:07:38 cli: lang: interpolating...
2021/11/25 10:07:38 cli: lang: building scope...
2021/11/25 10:07:38 cli: lang: running type unification...
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc081000388 stack=[0xc081000000, 0xc0a1000000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x1d7892a, 0x2fd5b80})
	/usr/lib/go/src/runtime/panic.go:1198 +0x71
runtime.newstack()
	/usr/lib/go/src/runtime/stack.go:1088 +0x5ac
runtime.morestack()
	/usr/lib/go/src/runtime/asm_amd64.s:461 +0x8b

goroutine 1 [running]:
runtime.heapBitsSetType(0xc101d8d270, 0x50, 0x48, 0x1c853a0)
	/usr/lib/go/src/runtime/mbitmap.go:822 +0xbcc fp=0xc081000398 sp=0xc081000390 pc=0x435dcc
runtime.mallocgc(0x48, 0x1c853a0, 0x1)
	/usr/lib/go/src/runtime/malloc.go:1100 +0x65e fp=0xc081000418 sp=0xc081000398 pc=0x42d39e
runtime.newobject(0x0)
	/usr/lib/go/src/runtime/malloc.go:1228 +0x27 fp=0xc081000440 sp=0xc081000418 pc=0x42d747
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18f7000})
	/home/jomxl/repos/mgmt/lang/types/type.go:98 +0x3a8 fp=0xc0810005f0 sp=0xc081000440 pc=0xb09208
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1b6e360})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810007a0 sp=0xc0810005f0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1d46d80})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081000950 sp=0xc0810007a0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081000b00 sp=0xc081000950 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081000cb0 sp=0xc081000b00 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081000e60 sp=0xc081000cb0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001010 sp=0xc081000e60 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810011c0 sp=0xc081001010 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081001370 sp=0xc0810011c0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001520 sp=0xc081001370 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810016d0 sp=0xc081001520 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001880 sp=0xc0810016d0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081001a30 sp=0xc081001880 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001be0 sp=0xc081001a30 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001d90 sp=0xc081001be0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081001f40 sp=0xc081001d90 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810020f0 sp=0xc081001f40 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810022a0 sp=0xc0810020f0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081002450 sp=0xc0810022a0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081002600 sp=0xc081002450 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810027b0 sp=0xc081002600 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081002960 sp=0xc0810027b0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081002b10 sp=0xc081002960 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081002cc0 sp=0xc081002b10 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081002e70 sp=0xc081002cc0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003020 sp=0xc081002e70 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810031d0 sp=0xc081003020 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003380 sp=0xc0810031d0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081003530 sp=0xc081003380 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810036e0 sp=0xc081003530 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003890 sp=0xc0810036e0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003a40 sp=0xc081003890 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081003bf0 sp=0xc081003a40 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003da0 sp=0xc081003bf0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081003f50 sp=0xc081003da0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004100 sp=0xc081003f50 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810042b0 sp=0xc081004100 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004460 sp=0xc0810042b0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004610 sp=0xc081004460 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810047c0 sp=0xc081004610 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081004970 sp=0xc0810047c0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004b20 sp=0xc081004970 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004cd0 sp=0xc081004b20 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081004e80 sp=0xc081004cd0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081005030 sp=0xc081004e80 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810051e0 sp=0xc081005030 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081005390 sp=0xc0810051e0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081005540 sp=0xc081005390 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810056f0 sp=0xc081005540 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810058a0 sp=0xc0810056f0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081005a50 sp=0xc0810058a0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081005c00 sp=0xc081005a50 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081005db0 sp=0xc081005c00 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081005f60 sp=0xc081005db0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081006110 sp=0xc081005f60 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810062c0 sp=0xc081006110 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081006470 sp=0xc0810062c0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081006620 sp=0xc081006470 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810067d0 sp=0xc081006620 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081006980 sp=0xc0810067d0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081006b30 sp=0xc081006980 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081006ce0 sp=0xc081006b30 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081006e90 sp=0xc081006ce0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007040 sp=0xc081006e90 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810071f0 sp=0xc081007040 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810073a0 sp=0xc0810071f0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007550 sp=0xc0810073a0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007700 sp=0xc081007550 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810078b0 sp=0xc081007700 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007a60 sp=0xc0810078b0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007c10 sp=0xc081007a60 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081007dc0 sp=0xc081007c10 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081007f70 sp=0xc081007dc0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081008120 sp=0xc081007f70 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810082d0 sp=0xc081008120 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081008480 sp=0xc0810082d0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081008630 sp=0xc081008480 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810087e0 sp=0xc081008630 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081008990 sp=0xc0810087e0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081008b40 sp=0xc081008990 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081008cf0 sp=0xc081008b40 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081008ea0 sp=0xc081008cf0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009050 sp=0xc081008ea0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009200 sp=0xc081009050 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc0810093b0 sp=0xc081009200 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009560 sp=0xc0810093b0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009710 sp=0xc081009560 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc0810098c0 sp=0xc081009710 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc081009a70 sp=0xc0810098c0 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009c20 sp=0xc081009a70 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009dd0 sp=0xc081009c20 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc081009f80 sp=0xc081009dd0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc08100a130 sp=0xc081009f80 pc=0xb090e7
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1bd8300})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc08100a2e0 sp=0xc08100a130 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a52060})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc08100a490 sp=0xc08100a2e0 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x1a994a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:148 +0x488 fp=0xc08100a640 sp=0xc08100a490 pc=0xb092e8
github.com/purpleidea/mgmt/lang/types.TypeOf({0x213d4e0, 0x18b95a0})
	/home/jomxl/repos/mgmt/lang/types/type.go:116 +0x287 fp=0xc08100a7f0 sp=0xc08100a640 pc=0xb090e7
...additional frames elided...

@purpleidea
Copy link
Owner

FYI: I looked into this briefly, and AFAICT it's not in the actual type unification/solver part of the code which is good.

I expect this relates to how our reflect related functions read the hetzner struct.

/cc @frebib

@purpleidea
Copy link
Owner

FYI: I think the fix is to not look at private fields.

@frebib
Copy link
Contributor

frebib commented Dec 1, 2021

This is an issue with type conversion, where TypeOf() tries to recursively convert types in a depth-first fashion, but hits a loop causing the same path to be followed infinitely until the stack is full. In this case, hcloud.Server includes an hcloud.Image, which includes a hcloud.Server
https://github.com/hetznercloud/hcloud-go/blob/master/hcloud/server.go#L35
https://github.com/hetznercloud/hcloud-go/blob/master/hcloud/image.go#L25

frebib added a commit to frebib/mgmt that referenced this issue Dec 1, 2021
Unexported fields should be ignored when mapping structs from Golang to
mcl, as this avoids issues where certain structs cannot be used in mcl
representation due to their structure that may be incompatible with
conversion. Disallowing private fields allows those to still be included
in the struct but ignored when mapping the types, allowing the mcl
representation of the type to stil be valid

Resolves: purpleidea#684
Signed-off-by: Joe Groocock <me@frebib.net>
frebib added a commit to frebib/mgmt that referenced this issue Dec 1, 2021
Unexported fields should be ignored when mapping structs from Golang to
mcl, as this avoids issues where certain structs cannot be used in mcl
representation due to their structure that may be incompatible with
conversion. Disallowing private fields allows those to still be included
in the struct but ignored when mapping the types, allowing the mcl
representation of the type to stil be valid

Resolves: purpleidea#684
Signed-off-by: Joe Groocock <me@frebib.net>
JefMasereel pushed a commit to JefMasereel/mgmt that referenced this issue Dec 3, 2021
Unexported fields should be ignored when mapping structs from Golang to
mcl, as this avoids issues where certain structs cannot be used in mcl
representation due to their structure that may be incompatible with
conversion. Disallowing private fields allows those to still be included
in the struct but ignored when mapping the types, allowing the mcl
representation of the type to stil be valid

Resolves: purpleidea#684
Signed-off-by: Joe Groocock <me@frebib.net>
LuausDalmolin added a commit to LuausDalmolin/mgmt that referenced this issue Aug 24, 2022
Unexported fields should be ignored when mapping structs from Golang to
mcl, as this avoids issues where certain structs cannot be used in mcl
representation due to their structure that may be incompatible with
conversion. Disallowing private fields allows those to still be included
in the struct but ignored when mapping the types, allowing the mcl
representation of the type to stil be valid

Resolves: purpleidea/mgmt#684
Signed-off-by: Joe Groocock <me@frebib.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants