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

Nomad task names with slashes fail #1135

Closed
leetrout opened this issue Apr 29, 2016 · 3 comments
Closed

Nomad task names with slashes fail #1135

leetrout opened this issue Apr 29, 2016 · 3 comments
Labels

Comments

@leetrout
Copy link

leetrout commented Apr 29, 2016

Nomad version

Nomad v0.3.2

Operating system and Environment details

CentOS Linux release 7.2.1511 (Core)
Linux lees-remote-dev 3.10.0-327.10.1.el7.x86_64 #1 SMP Tue Feb 16 17:03:50 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Issue

I created a task with the same name as my image. When using a slash in a task name running the job fails with the error:

2016/04/28 22:06:24 [ERR] client: failed to start task 'amos/build-8' for alloc 'd60c2cd5-5e61-6105-7386-ec23fc266d28': error creating rpc client for executor plugin: plugin exited before we could connect

It wasn't immediately clear that the slash was the problem until I saw the logs. Perhaps it would be good to do some or all of the following:

  • support this by running os.MkdirAll
  • sanitize the name before using it in a path. e.g. slugify it
  • check the config and report an accurate error
  • add additional details to the documentation that note the task name is used to create files on disk

I'd be happy to contribute a patch if someone has some direction on the best solution(s).

Reproduction steps

Create a job with a task name with a slash.

Nomad Server logs

2016/04/28 22:06:24 [DEBUG] driver.docker: identified image 127.0.0.1:5000/amos/build-8 as sha256:c73e3f8ce8c8efe2fc48a601d2ce001fbdbc0f898928da1eb3ffeb9579d4bd7e
    2016/04/28 22:06:24 [DEBUG] plugin: starting plugin: /usr/local/bin/nomad []string{"/usr/local/bin/nomad", "executor", "/run/nomad/alloc/d60c2cd5-5e61-6105-7386-ec23fc266d28/amos/build-8/amos/build-8-executor.out"}
    2016/04/28 22:06:24 [DEBUG] plugin: waiting for RPC address for: /usr/local/bin/nomad
    2016/04/28 22:06:24 [DEBUG] plugin: nomad: open /run/nomad/alloc/d60c2cd5-5e61-6105-7386-ec23fc266d28/amos/build-8/amos/build-8-executor.out: no such file or directory
    2016/04/28 22:06:24 [DEBUG] plugin: /usr/local/bin/nomad: plugin process exited

Job file

Bad job

job "example" {
        datacenters = ["dc1"]
        type = "batch"
        group "amos-b-8" {
                task "amos/build-8" {
                        driver = "docker"
                        config {
                                image = "127.0.0.1:5000/amos/build-8"
                        }
                        resources {
                                cpu = 500 # 500 Mhz
                                memory = 500 # 256MB
                                network {
                                        mbits = 10
                                }
                        }
                }
        }
}

Good job

job "example" {
        datacenters = ["dc1"]
        type = "batch"
        group "amos-b-8" {
                task "amos-build-8" {
                        driver = "docker"
                        config {
                                image = "127.0.0.1:5000/amos/build-8"
                        }
                        resources {
                                cpu = 500 # 500 Mhz
                                memory = 500 # 256MB
                                network {
                                        mbits = 10
                                }
                        }
                }
        }
}
@dadgar
Copy link
Contributor

dadgar commented May 3, 2016

Hey @leetrout,

I think our best path forward is disallowing tasks containing the slash from being submitted. This can be accomplished by patching the validation logic.

https://github.com/hashicorp/nomad/blob/master/nomad/structs/structs.go#L1708

Look forward to your PR 👍

@leetrout
Copy link
Author

leetrout commented May 3, 2016

Great, thanks for the direction.

@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 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants