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

Ulimits are uint64 but can be negative #341

Open
optiz0r opened this issue May 14, 2024 · 0 comments
Open

Ulimits are uint64 but can be negative #341

optiz0r opened this issue May 14, 2024 · 0 comments

Comments

@optiz0r
Copy link
Contributor

optiz0r commented May 14, 2024

https://github.com/hashicorp/nomad-driver-podman/blob/main/api/structs.go#L675 defines the soft and hard values for ulimits as uint64

Podman allows a container to be launched with -1 as a valid ulimit value, which means to use the user's maximum permitted value for the setting (https://docs.podman.io/en/stable/markdown/podman-run.1.html#ulimit-option)

A job spec which uses this might contain:

task "memcached" {
  driver = "podman"
  image = "memcached:latest"
  config {
    ulimit {
      memlock = "-1:-1"
    }
    args = ["--lock-memory"]
  }
}

This results in an allocation failing to start up with an error message like:

Driver Failure
rpc error: code = Unknown desc = failed to start task, could not inspect container : json: cannot unmarshal number -1 into Go struct field InspectUlimit.HostConfig.Ulimits.Soft of type uint64

Edit: The same thing works in the docker driver without error. Quickly scanning the docker driver code, I can't see that ulimit values there are handled as anything other than strings, but I might have missed something.

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

1 participant