chronos icon indicating copy to clipboard operation
chronos copied to clipboard

Chronos should not add invalid characters to the Task ID

Open tdooner opened this issue 9 years ago • 9 comments

The TaskUtils.getTaskId method adds the values of the arguments array to the end of the task ID.

This makes for more-readable IDs in the case of common arguments like -v, but Mesos considers / to be an invalid character in Task ID. This prevents me from a job configuration like:

"command": "cat",
"arguments": ["/etc/passwd"],

Mesos master (0.23.0) logs the following:

I1001 16:35:05.784687  5022 master.cpp:3792] Sending status update TASK_ERROR (UUID: [snip]) for task ct:1443717301964:0:my_chronos_job_name:cat /etc/password of framework 20150714-191408-4163031306-5050-1590-0001 'TaskID 'ct:1443717301964:0:my_chronos_job:cat /etc/passwd' contains invalid characters'

In my opinion, Chronos should either:

  1. Strip invalid characters from the Task ID, or
  2. Not add the arguments array to the Task ID in the first place

Since I don't see the benefit from adding the arguments, and the arguments can be quite long, I would prefer the second option. But whatever, I'd be happy with simply being able to use slashes in the arguments array. Thanks.

tdooner avatar Oct 01 '15 16:10 tdooner

Agree, If you get any quick resolution for the same, please post it. This is deal breaker for us.

Saurabh2004in avatar Oct 01 '15 21:10 Saurabh2004in

Agree with the second point too, put arguments as part of Task ID value is useless.

gomes avatar Oct 01 '15 22:10 gomes

@Saurabh2004in I'm hacking around it by simply not using the arguments array, and instead putting them as part of the command, e.g.:

  "shell": true,    // (the default)
  "command": "cat /etc/passwd"

However, this breaks when your Docker image has a custom entrypoint. In that case, I have no good resolution.

tdooner avatar Oct 01 '15 23:10 tdooner

@tdooner @Saurabh2004in arguments should be used when you use entrypoint in your docker container.

gomes avatar Oct 01 '15 23:10 gomes

Arguments are also incredibly useful when you want to avoid having a shell as pid1 inside your container (making it difficult to respond to signals). Seems the default is to run sh -c '{command}'. We're currently working around with command: "exec dumb-init ..." but this is non-ideal...

asottile avatar Dec 11 '15 03:12 asottile

Has anyone found a workaround for the cases where I need to pass the arguments to the Docker entrypoint?

pbnsilva avatar Jan 06 '16 15:01 pbnsilva

@pbnsilva I think most people are just calling the real entrypoint via bash as a temporary workaround.

mcoffin avatar Jan 06 '16 17:01 mcoffin

I'm using @tdooner's solution:

  "shell": true,    // (the default)
  "command": "cat /etc/passwd"

mindscratch avatar Jan 25 '17 17:01 mindscratch

The problem is that Chronos concatenates job arguments with space in Mesos task ID, which is not allowed. To workaround the issue, you can change the taskIdTemplate in src/main/scala/org/apache/mesos/chronos/scheduler/jobs/TaskUtils.scala to discard arguments in the task ID.

dcvan24 avatar Jan 25 '18 20:01 dcvan24