Skip to content

Go Serialization panics on nested struct field. #87

@sadiq1971

Description

@sadiq1971

It seems the serialization is panicking in the case of a struct containing a nested field. Not sure whether this feature is supported or not, or is there anything that needs to be done on the .fbe file as nothing is mentioned on the docs
fbe file definition:

package proto

struct NestedTest
{
   NestedTest? nested;
}

The command used for building go source files:
fbec --input=nested.fbe --output=. --go --final --proto --json

Go code for serialization:

        cnt := filespb.NewNestedTest()
	writer := filespb.NewNestedTestFinalModel(fbe.NewEmptyBuffer())
	if _, err := writer.Serialize(cnt); err != nil {
		panic("serialization error")
	}
	if ok := writer.Verify(); !ok {
		panic("verify error")
	}

panic trace:

runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc023180418 stack=[0xc023180000, 0xc043180000]
fatal error: stack overflow

runtime stack:
runtime.throw({0xe0939b?, 0x14ccaa0?})
	/home/sadiq/go/go1.19.1/src/runtime/panic.go:1047 +0x5d fp=0x7f8ca1ffacb8 sp=0x7f8ca1ffac88 pc=0x43b57d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions