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 when merging client config sections #2549

Closed
ashald opened this issue Apr 11, 2017 · 3 comments
Closed

Panic when merging client config sections #2549

ashald opened this issue Apr 11, 2017 · 3 comments

Comments

@ashald
Copy link

ashald commented Apr 11, 2017

Nomad version

0.5.6

Operating system and Environment details

Centos 7

Issue

Panic when merging client configs

Reproduction steps

/etc/nomad/a.json

{
    "client": {
        "enabled": true,
        ....
    },
    ...
}

/etc/nomad/b.json

config_meta.json
{
    "client": {
        "meta": {
            "external_host": "true"
        }
    }
}

Nomad Client logs (if appropriate)

$ nomad agent -config=/etc/nomad/
panic: runtime error: index out of range

goroutine 1 [running]:
github.com/hashicorp/nomad/command/agent.parseClient(0xc4204064a8, 0xc420422cc0, 0x1, 0x1)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config_parse.go:317 +0xcfd
github.com/hashicorp/nomad/command/agent.parseConfig(0xc420406420, 0xc420422680, 0xc420341650, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config_parse.go:150 +0xd1b
github.com/hashicorp/nomad/command/agent.ParseConfig(0x1a67040, 0xc4203d8318, 0xc4203d8318, 0x0, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config_parse.go:64 +0x222
github.com/hashicorp/nomad/command/agent.ParseConfigFile(0xc420340f60, 0x25, 0x0, 0x0, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config_parse.go:31 +0xd7
github.com/hashicorp/nomad/command/agent.LoadConfigDir(0x7ffcbe5af5ae, 0xb, 0x0, 0x0, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config.go:1239 +0x82b
github.com/hashicorp/nomad/command/agent.LoadConfig(0x7ffcbe5af5ae, 0xb, 0x1, 0x1, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/config.go:1167 +0x348
github.com/hashicorp/nomad/command/agent.(*Command).readConfig(0xc4203e6280, 0xc4203e27e0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/command.go:166 +0x1229
github.com/hashicorp/nomad/command/agent.(*Command).Run(0xc4203e6280, 0xc420010260, 0x1, 0x1, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/command/agent/command.go:421 +0x154
github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli.(*CLI).Run(0xc4203e40c0, 0xc4203e40c0, 0x1e, 0xc4203d4220)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/vendor/github.com/mitchellh/cli/cli.go:154 +0x1a8
main.RunCustom(0xc420010250, 0x2, 0x2, 0xc420340480, 0x0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/main.go:57 +0xa5a
main.Run(0xc420010250, 0x2, 0x2, 0xc4200001a0)
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/main.go:20 +0x56
main.main()
        /home/build/workspace/go/path/src/github.com/hashicorp/nomad/main.go:16 +0x64

@dadgar
Copy link
Contributor

dadgar commented Apr 11, 2017

Hey @ashald Thanks for filing that. I would recommend you pass the configs as hcl files for the time being. The parser is only tested with HCL at the moment and as such you are more likely to run into bugs! Sorry about that!

@tgross
Copy link
Member

tgross commented Dec 20, 2019

Doing some cleanup of old issues. I can confirm this was fixed in Nomad 0.9.2 w/ #1290

./config/base.json

{
  "client": {
    "enabled": true
  },
  "server": {
    "enabled": true,
    "bootstrap_expect": 1
  }
}

./config/meta.json

{
    "client": {
        "meta": {
            "external_host": "true"
        }
    }
}
▶ nomad092 agent -dev -config=./config
==> Loaded configuration from config/base.json, config/meta.json
==> Starting Nomad agent...
==> Nomad agent configuration:

       Advertise Addrs: HTTP: 127.0.0.1:4646; RPC: 127.0.0.1:4647; Serf: 127.0.0.1:4648
            Bind Addrs: HTTP: 127.0.0.1:4646; RPC: 127.0.0.1:4647; Serf: 127.0.0.1:4648
                Client: true
             Log Level: DEBUG
                Region: global (DC: dc1)
                Server: true
               Version: 0.9.2
...

@tgross tgross closed this as completed Dec 20, 2019
@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 Nov 15, 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