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

POST /v2/apps unstable #1979

Closed
Kosta-Github opened this issue Aug 11, 2015 · 2 comments
Closed

POST /v2/apps unstable #1979

Kosta-Github opened this issue Aug 11, 2015 · 2 comments

Comments

@Kosta-Github
Copy link

This seems to be a regression with 9.x since I haven't experienced this behavior with 8.x.

When adding a new app, e.g. this sample elasticsearch (but it also happens with many others of my apps):

$ cat marathon.config.json

{
    "id":   "elasticsearch",
    "cpus": 1.5,
    "mem":  4096,
    "container": {
        "type":   "DOCKER",
        "docker": {
            "image":          "elasticsearch:1.6",
            "forcePullImage": true,
            "network":        "BRIDGE",
            "portMappings":   [
                { "containerPort": 9200, "hostPort": 9200, "servicePort": 9200 },
                { "containerPort": 9300, "hostPort": 9300, "servicePort": 9300 }
            ]
        }
    },
    "env": {
        "SERVICE_9200_NAME":   "elasticsearch",
        "SERVICE_9200_TAGS":   "haproxy",
        "SERVICE_9300_IGNORE": "true",
        "DOCKERSTASH_NAME":    "elasticsearch",
        "DOCKERSTASH_IGNORE":  "true"
    },
    "healthChecks": [
        {
          "protocol":               "HTTP",
          "path":                   "/",
          "gracePeriodSeconds":     120,
          "intervalSeconds":         30,
          "timeoutSeconds":          15,
          "maxConsecutiveFailures":  10
        }
    ],
    "constraints": [ [ "log_node", "CLUSTER", "true" ], [ "hostname", "UNIQUE" ] ]
}

via curl I often get a 200 OK back instead of the expected 201 Created:

$ curl --silent -X POST http://${MARATHON_HOST}/v2/apps -H "content-type: application/json" --data-binary @marathon.config.json

*   Trying 10.50.80.38...
* Connected to <deleted> (10.50.80.38) port 80 (#0)
> POST /v2/apps HTTP/1.1
> User-Agent: curl/7.41.0
> Host: <deleted>
> Accept: */*
> content-type: application/json
> Content-Length: 1103
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 200 OK
< Connection: close
< Server: Jetty(8.y.z-SNAPSHOT)
<
* Closing connection 0

The marathon logs contain this error/stacktrace:

WARN  (mesosphere.marathon.api.MarathonExceptionMapper:30)
com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
 at [Source: [B@3fd7430d; line: 1, column: 1]
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:164)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3095)
    at com.fasterxml.jackson.databind.ObjectMapper._readValue(ObjectMapper.java:3009)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1637)
    at play.api.libs.json.JacksonJson$.parseJsValue(JsValue.scala:482)
    at play.api.libs.json.Json$.parse(Json.scala:30)
    at mesosphere.marathon.api.v2.AppsResource.replace(AppsResource.scala:191)
    at sun.reflect.GeneratedMethodAccessor284.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.codahale.metrics.jersey.InstrumentedResourceMethodDispatchProvider$TimedRequestDispatcher.dispatch(InstrumentedResourceMethodDispatchProvider.java:30)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:263)
    at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:178)
    at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:62)
    at mesosphere.marathon.api.CacheDisablingFilter.doFilter(CacheDisablingFilter.scala:18)
    at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
    at mesosphere.marathon.api.CORSFilter.doFilter(CORSFilter.scala:46)
    at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
    at mesosphere.marathon.api.LeaderProxyFilter.doFilter(LeaderProxyFilter.scala:121)
    at com.google.inject.servlet.FilterDefinition.doFilter(FilterDefinition.java:163)
    at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:58)
    at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:118)
    at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:113)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at com.codahale.metrics.jetty8.InstrumentedHandler.handle(InstrumentedHandler.java:192)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:370)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:745)

If I retry the curl command several times I eventually get the expected 201 Created:

$ curl --silent -X POST http://${MARATHON_HOST}/v2/apps -H "content-type: application/json" --data-binary @marathon.config.json

*   Trying 10.50.80.38...
* Connected to <deleted> (10.50.80.38) port 80 (#0)
> POST /v2/apps HTTP/1.1
> User-Agent: curl/7.41.0
> Host: <deleted>
> Accept: */*
> content-type: application/json
> Content-Length: 1103
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
< HTTP/1.1 201 Created
< X-Marathon-Leader: http://ant-002:8080
< Cache-Control: no-cache, no-store, must-revalidate
< Pragma: no-cache
< Expires: 0
< Location: http://<deleted>/v2/apps/elasticsearch
< Content-Type: application/json
< Connection: close
< Server: Jetty(8.y.z-SNAPSHOT)
<
{"id":"/elasticsearch","cmd":null,"args":null,"user":null,"env":{"DOCKERSTASH_IGNORE":"true","DOCKERSTASH_NAME":"elasticsearch","SERVICE_9200_TAGS":"haproxy","SERVICE_9200_NAME":"elasticsearch","SERVICE_9300_IGNORE":"true"},"instances":1,"cpus":1.5,"mem":4096.0,"disk":0.0,"executor":"","constraints":[["log_node","CLUSTER","true"],["hostname","UNIQUE"]],"uris":[],"storeUrls":[],"ports":[0],"requirePorts":false,"backoffFactor":1.15,"container":{"type":"DOCKER","volumes":[],"docker":{"image":"elasticsearch:1.6","network":"BRIDGE","portMappings":[{"containerPort":9200,"hostPort":9200,"servicePort":9200,"protocol":"tcp"},{"containerPort":9300,"hostPort":9300,"servicePort":9300,"protocol":"tcp"}],"privileged":false,"parameters":[],"forcePullImage":true}},"healthChecks":[{"path":"/","protocol":"HTTP","portIndex":0,"command":null,"gracePeriodSeconds":120,"intervalSeconds":30,"timeoutSeconds":15,"maxConsecutiveFailures":10,"ignoreHttp1xx":false}],"dependencies":[],"upgradeStrategy":{"minimumHealthCapacity":1.0,"maximumOverCapacity":1.0},"labels":{},"acceptedResourceRoles":null,"version":"2015-08-11T10:36:40.557Z","tasks":[],"deployments":[{"id":"ac206f88-6532-4a7f-acb7-9cc5102b238"}],"tasksStaged":0,"tasksRunning":0,"tasksHealthy":0,"tasksUnhealthy":0,"backoffSeconds":1,"maxLaunchDelaySeconds":3600}
* Closing connection 0
@Kosta-Github Kosta-Github changed the title PUT /v2/apps unstable POST /v2/apps unstable Aug 11, 2015
@Kosta-Github
Copy link
Author

BTW, I see the same behavior with PUT for updating existing apps...

@kolloch
Copy link
Contributor

kolloch commented Aug 11, 2015

Hi @Kosta-Github, thanks for reporting this.

This seems to be a duplicate of #1763.

So either use Java 8 or explicitly prevent the "Expect: 100-continue" header.

If you think that this is not a duplicate, please elaborate and reopen.

@kolloch kolloch closed this as completed Aug 11, 2015
@mesosphere mesosphere locked and limited conversation to collaborators Mar 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants