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

"panic: unquote err: invalid syntax" on invalid JSON #1754

Closed
jippi opened this issue Sep 27, 2016 · 3 comments
Closed

"panic: unquote err: invalid syntax" on invalid JSON #1754

jippi opened this issue Sep 27, 2016 · 3 comments

Comments

@jippi
Copy link
Contributor

jippi commented Sep 27, 2016

Nomad version

Nomad v0.4.1

Issue

Invalid JSON payload causes panic in parse step

I'm aware its a complete invalid job spec, but just hit the bug while testing my migration tool from supervisor to nomad

Having resources as NULL makes the parser sad

Reproduction steps

nomad plan file.json (where file.json is the spec below)

Nomad Server logs (if appropriate)

Nomad Client logs (if appropriate)

panic: unquote  err: invalid syntax

goroutine 1 [running]:
panic(0xe60dc0, 0xc42023e9f0)
    /opt/go/src/runtime/panic.go:500 +0x1a1
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/hcl/token.Token.Value(0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x101eb80, 0x0, 0x0, 0xc42023e9d0, ...)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/hcl/token/token.go:163 +0x6be
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeString(0xc420235630, 0xc42023c700, 0x35, 0x173d180, 0xc42005dae0, 0xea6d40, 0xc42023e9a0, 0x194, 0x415758, 0x10)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:466 +0xb9
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc42023c700, 0x35, 0x173d180, 0xc42005dae0, 0xea6d40, 0xc42023e9a0, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:106 +0x83a
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeInterface(0xc420235630, 0xc42023c700, 0x35, 0x173d180, 0xc42005dae0, 0xea6d40, 0xc42023e9a0, 0x194, 0x177e800, 0xe2d200)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:284 +0x2ab
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc42023c700, 0x35, 0x173d180, 0xc42005dae0, 0xea6d40, 0xc42023e9a0, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:98 +0x4fb
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeMap(0xc420235630, 0xc420123b90, 0x2b, 0x173d240, 0xc420214260, 0xec0b80, 0xc42002e468, 0x195, 0x415758, 0xe3e5a0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:378 +0x7ac
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420123b90, 0x2b, 0x173d280, 0xc4200750e0, 0xec0b80, 0xc42002e468, 0x195, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:100 +0x647
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeSlice(0xc420235630, 0xc420123b60, 0x28, 0x173d280, 0xc4200750e0, 0xea6d40, 0xc42023e770, 0x194, 0xec0b80, 0x3)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:446 +0x3c2
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420123b60, 0x28, 0x173d280, 0xc4200750e0, 0xea6d40, 0xc42023e770, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:104 +0x8d6
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeInterface(0xc420235630, 0xc420123b60, 0x28, 0x173d280, 0xc4200750e0, 0xea6d40, 0xc42023e770, 0x194, 0x177e800, 0xe2d200)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:284 +0x2ab
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420123b60, 0x28, 0x173d280, 0xc4200750e0, 0xea6d40, 0xc42023e770, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:98 +0x4fb
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeMap(0xc420235630, 0xc420214640, 0x20, 0x173d240, 0xc420214660, 0xec0b80, 0xc42002e458, 0x195, 0x415758, 0xe3e5a0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:378 +0x7ac
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420214640, 0x20, 0x173d1c0, 0xc420075560, 0xec0b80, 0xc42002e458, 0x195, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:100 +0x647
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeSlice(0xc420235630, 0xc4202145e0, 0x1d, 0x173d240, 0xc4202145c0, 0xea6d40, 0xc42023e700, 0x194, 0xec0b80, 0x1)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:446 +0x3c2
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc4202145e0, 0x1d, 0x173d240, 0xc4202145c0, 0xea6d40, 0xc42023e700, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:104 +0x8d6
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeInterface(0xc420235630, 0xc4202145e0, 0x1d, 0x173d240, 0xc4202145c0, 0xea6d40, 0xc42023e700, 0x194, 0x177e800, 0xe2d200)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:284 +0x2ab
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc4202145e0, 0x1d, 0x173d240, 0xc4202145c0, 0xea6d40, 0xc42023e700, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:98 +0x4fb
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeMap(0xc420235630, 0xc420214580, 0x18, 0x173d240, 0xc420214220, 0xec0b80, 0xc42002e440, 0x195, 0x415758, 0xe3e5a0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:378 +0x7ac
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420214580, 0x18, 0x173d280, 0xc420074f00, 0xec0b80, 0xc42002e440, 0x195, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:100 +0x647
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeSlice(0xc420235630, 0xc420214520, 0x15, 0x173d280, 0xc420074f00, 0xea6d40, 0xc42023e5e0, 0x194, 0xec0b80, 0x2)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:446 +0x3c2
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420214520, 0x15, 0x173d280, 0xc420074f00, 0xea6d40, 0xc42023e5e0, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:104 +0x8d6
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeInterface(0xc420235630, 0xc420214520, 0x15, 0x173d280, 0xc420074f00, 0xea6d40, 0xc42023e5e0, 0x194, 0x177e800, 0xe2d200)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:284 +0x2ab
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc420214520, 0x15, 0x173d280, 0xc420074f00, 0xea6d40, 0xc42023e5e0, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:98 +0x4fb
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeMap(0xc420235630, 0xc42023e590, 0xd, 0x173d240, 0xc420214500, 0xec0b80, 0xc42002e430, 0x195, 0x415758, 0xe3e5a0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:378 +0x7ac
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc42023e590, 0xd, 0x173d1c0, 0xc420075500, 0xec0b80, 0xc42002e430, 0x195, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:100 +0x647
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeSlice(0xc420235630, 0xc42023e540, 0xa, 0x173d240, 0xc420214480, 0xea6d40, 0xc42023e560, 0x194, 0xec0b80, 0x1)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:446 +0x3c2
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc42023e540, 0xa, 0x173d240, 0xc420214480, 0xea6d40, 0xc42023e560, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:104 +0x8d6
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeInterface(0xc420235630, 0xc42023e540, 0xa, 0x173d240, 0xc420214480, 0xea6d40, 0xc42023e560, 0x194, 0x177e800, 0xe2d200)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:284 +0x2ab
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0xc42023e540, 0xa, 0x173d240, 0xc420214480, 0xea6d40, 0xc42023e560, 0x194, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:98 +0x4fb
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decodeMap(0xc420235630, 0x10202e1, 0x4, 0x173d240, 0xc4202141c0, 0xec0b80, 0xc42002e3e8, 0x195, 0x8, 0xc4202355c8)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:378 +0x7ac
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.(*decoder).decode(0xc420235630, 0x10202e1, 0x4, 0x173d280, 0xc420074d20, 0xec0b80, 0xc42002e3e8, 0x195, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:100 +0x647
github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl.DecodeObject(0xe3e5a0, 0xc42002e3e8, 0x173d280, 0xc420074d20, 0x0, 0x22)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/hashicorp/hcl/decoder.go:60 +0x132
github.com/hashicorp/nomad/jobspec.parseJob(0xc42000ad00, 0xc420214320, 0x1, 0x1)
    /opt/gopath/src/github.com/hashicorp/nomad/jobspec/parse.go:97 +0xcc
github.com/hashicorp/nomad/jobspec.Parse(0x1739940, 0xc42002e318, 0xc42002e318, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/jobspec/parse.go:63 +0x368
github.com/hashicorp/nomad/command.(*JobGetter).StructJob(0xc42005d4d8, 0x7ffce4f5b85b, 0xa, 0x0, 0x0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/command/helpers.go:283 +0x308
github.com/hashicorp/nomad/command.(*PlanCommand).Run(0xc42005d4a0, 0xc42000c290, 0x1, 0x1, 0xc4201617c0)
    /opt/gopath/src/github.com/hashicorp/nomad/command/plan.go:102 +0x28a
github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc420124480, 0xc420124480, 0x17, 0xc42014d820)
    /opt/gopath/src/github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli/cli.go:153 +0x330
main.RunCustom(0xc42000c280, 0x2, 0x2, 0xc4201232c0, 0x0)
    /opt/gopath/src/github.com/hashicorp/nomad/main.go:55 +0x7a1
main.Run(0xc42000c280, 0x2, 0x2, 0xc4200001a0)
    /opt/gopath/src/github.com/hashicorp/nomad/main.go:20 +0x56
main.main()
    /opt/gopath/src/github.com/hashicorp/nomad/main.go:16 +0x66

Job file (if appropriate)

{
    "job": {
        "bownty": {
            "datacenters": [
                "online",
                "bownty"
            ],
            "group": {
                "php-fpm": {
                    "count": 1,
                    "task": {
                        "php-fpm": {
                            "driver": "raw_exec",
                            "config": {
                                "command": "/usr/sbin/php-fpm7.0 --fpm-config=/etc/bownty/bownty/php-fpm/manager.conf",
                                "args": []
                            },
                            "resources": null
                        }
                    }
                }
            }
        }
    }
}
@jippi
Copy link
Contributor Author

jippi commented Sep 27, 2016

same issue if count is null too

@dadgar
Copy link
Contributor

dadgar commented Sep 27, 2016

Thanks @jippi! We should catch this!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants