[ 
https://issues.apache.org/jira/browse/MESOS-4812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244554#comment-15244554
 ] 

haosdent commented on MESOS-4812:
---------------------------------

My marathon task json
{code}
{
  "app": {
    "id": "/test-health",
    "cmd": "sleep 200",
    "args": null,
    "user": null,
    "env": {},
    "instances": 1,
    "cpus": 1,
    "mem": 128,
    "disk": 0,
    "executor": "",
    "constraints": [],
    "uris": [],
    "fetch": [],
    "storeUrls": [],
    "ports": [
      10000
    ],
    "portDefinitions": [
      {
        "port": 10000,
        "protocol": "tcp",
        "labels": {}
      }
    ],
    "requirePorts": false,
    "backoffSeconds": 1,
    "backoffFactor": 1.15,
    "maxLaunchDelaySeconds": 3600,
    "container": null,
    "healthChecks": [
      {
        "protocol": "COMMAND",
        "command": {
          "value": "bash -c \"</dev/tcp/www.google.com/80\""
        },
        "gracePeriodSeconds": 300,
        "intervalSeconds": 60,
        "timeoutSeconds": 20,
        "maxConsecutiveFailures": 3,
        "ignoreHttp1xx": false
      }
    ],
    "readinessChecks": [],
    "dependencies": [],
    "upgradeStrategy": {
      "minimumHealthCapacity": 1,
      "maximumOverCapacity": 1
    },
    "labels": {},
    "acceptedResourceRoles": null,
    "ipAddress": null,
    "version": "2016-04-17T06:24:40.457Z",
    "residency": null,
    "versionInfo": {
      "lastScalingAt": "2016-04-17T06:24:40.457Z",
      "lastConfigChangeAt": "2016-04-17T06:24:40.457Z"
    },
    "tasksStaged": 0,
    "tasksRunning": 1,
    "tasksHealthy": 1,
    "tasksUnhealthy": 0,
    "deployments": [],
    "tasks": [
      {
        "id": "test-health.1108b4a6-0465-11e6-9af4-0242d20a0294",
        "slaveId": "7f8c8ce6-45b2-4e63-a5c4-a88e08af12ed-S0",
        "host": "127.0.0.1",
        "startedAt": "2016-04-17T06:24:40.770Z",
        "stagedAt": "2016-04-17T06:24:40.537Z",
        "ports": [
          31619
        ],
        "version": "2016-04-17T06:24:40.457Z",
        "ipAddresses": [
          {
            "ipAddress": "127.0.0.1",
            "protocol": "IPv4"
          }
        ],
        "appId": "/test-health",
        "healthCheckResults": [
          {
            "alive": true,
            "consecutiveFailures": 0,
            "firstSuccess": "2016-04-17T06:24:40.924Z",
            "lastFailure": null,
            "lastSuccess": "2016-04-17T06:24:40.924Z",
            "lastFailureCause": null,
            "taskId": "test-health.1108b4a6-0465-11e6-9af4-0242d20a0294"
          }
        ]
      }
    ]
  }
}
{code}

Which could pass health check in Mesos
{code}
Registered executor on 127.0.0.1
Starting task test-health.1108b4a6-0465-11e6-9af4-0242d20a0294
sh -c 'sleep 200'
Forked command at 27046
Launching health check process: 
/home/haosdent/mesos/build/src/mesos-health-check 
--executor=(1)@127.0.0.1:39822 
--health_check_json={"command":{"shell":true,"value":"bash -c 
\"<\/dev\/tcp\/www.google.com\/80\""},"consecutive_failures":3,"delay_seconds":0.0,"grace_period_seconds":300.0,"interval_seconds":60.0,"timeout_seconds":20.0}
 --task_id=test-health.1108b4a6-0465-11e6-9af4-0242d20a0294
Health check process launched at pid: 27047
Received task health update, healthy: true
{code}

> Mesos fails to escape command health checks
> -------------------------------------------
>
>                 Key: MESOS-4812
>                 URL: https://issues.apache.org/jira/browse/MESOS-4812
>             Project: Mesos
>          Issue Type: Bug
>    Affects Versions: 0.25.0
>            Reporter: Lukas Loesche
>            Assignee: haosdent
>              Labels: health-check
>
> As described in https://github.com/mesosphere/marathon/issues/3333
> I would like to run a command health check
> {noformat}
> /bin/bash -c "</dev/tcp/$HOST/$PORT0"
> {noformat}
> The health check fails because Mesos, while running the command inside double 
> quotes of a sh -c "" doesn't escape the double quotes in the command.
> If I escape the double quotes myself the command health check succeeds. But 
> this would mean that the user needs intimate knowledge of how Mesos executes 
> his commands which can't be right.
> I was told this is not a Marathon but a Mesos issue so am opening this JIRA. 
> I don't know if this only affects the command health check.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to