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

Leak in reflect when using Load() against JSON file (on a non-Register()ed type) #8

Open
igorastds opened this issue Jan 23, 2017 · 1 comment

Comments

@igorastds
Copy link

igorastds commented Jan 23, 2017

TL;DR:
bug.json:
{"Head": {"StepSize": 2,"Hacks": {"Backup": {"A": 1,"Users": [1, 2, 3, 4],"S":"S"}}}}

	cfg.Load("bug.json")
        foo struct { Hacks struct { Backup struct { Users []int } } }
x:
	cfg.Configure(&foo, "Head")
	if len(foo.Hacks.Backup.Users) < 1 {
		tries++
		goto x
	}
	log.Println(fmt.Sprintf("ok done, took %d tries, got %v", tries, foo.Hacks.Backup.Users))

The results to get this structure parsed are varying between taking 8000 - 160000 tries on my machine, and this is not even supposed to work I guess. Test code: http://pastebin.com/FLQVtDYZ, tested on 1.6.2 and 1.8

@qiangxue
Copy link
Member

Issue confirmed. I will look into it. Thanks!

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

No branches or pull requests

2 participants