Search code examples
hashicorprhel8nomad

Nomad .net Core 8 service and Exit Code: 134, Signal: 6


I am trying to setup very simple .net core 8 console app running under nomad. Here is my job specification:

job "my-service" {
  datacenters = ["dc1"]
  type = "batch"

  group "group1" {
     scaling {
      min     = 1
      max     = 10
      enabled = true
}

constraint {
    attribute = "10.168.30.45"
    operator  = "set_contains"
    value     = "${attr.unique.network.ip-address}"
  }


   task "raw" {
      driver = "exec"

      artifact {
        source      = "https://my-registry.com/my-service.zip"
        destination = "local"
      }

      config {
        command = "/local/my-service/My.Linux.Service"
        args = ["arg1"]
      }
resources {
        memory = 64
      }
    }

    }
  }

My nomad client is RHEL 8. I installed .net 8 on my RHEL box and also run my service executing the command My.Linux.Service arg1 and it works just fine as seen below:

enter image description here

When I run my nomad job, I get the following error:

Exit Code: 134, Signal: 6

and job just terminates

I also enabled raw_exec plugin on my Nomad client and tried that as well with no avail. Any help in this regards is appreciated.


Solution

  • As reported, the issue was that the executable was expecting to be run from the same working directory as other files from the archive.

    The simplest solution is to change the current working directory before executing the executable with just a small shell script.

    command = "sh"
    args = ["-c", "cd ${NOMAD_TASK_DIR}/my-service && ./my-service arg1"]