Uploaded image for project: 'Marathon'
  1. Marathon
  2. MARATHON-2609

GET on empty apps list throws exception

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Medium
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: Marathon 1.4.0
    • Component/s: None
    • Labels:

      Description

      I don't know if this is intended behavior - if it is, please close, if not, I'll work on a PR.

      When I try to call a GET on /v2/apps with no applications created, marathon returns a 500. I would expect a 404 or 200 with an empty list.

      Client side 500 received:

      Unable to find source-code formatter for language: [. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
       2017-01-09 15:15:28,537 ERROR ] [MarathonClient] FAILING OVER MARATHON CALL: http://172.30.254.1:8080/
      javax.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
      	at org.glassfish.jersey.client.JerseyInvocation.convertToException(JerseyInvocation.java:968)
      	at org.glassfish.jersey.client.JerseyInvocation.translate(JerseyInvocation.java:795)
      	at org.glassfish.jersey.client.JerseyInvocation.access$500(JerseyInvocation.java:91)
      	at org.glassfish.jersey.client.JerseyInvocation$2.call(JerseyInvocation.java:683)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:424)
      	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:679)
      	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:408)
      	at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:308)
      	at xx.makeRequest(xx.java:117)
      	at yy.WorkerTask.run(yy.java:108)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at java.lang.Thread.run(Thread.java:745)
      
      

      Server Side 500 thrown:

      Unable to find source-code formatter for language: [. Available languages are: actionscript, html, java, javascript, none, sql, xhtml, xml
      2017-01-09 21:15:25,490] INFO  172.30.254.1 - - [09/Jan/2017:21:15:25 +0000] "GET //172.30.254.1:8080/v2/apps HTTP/1.1" 200 11 "-" "Jersey/2.14 (HttpUrlConnection 1.7.0_55)"  (mesosphere.chaos.http.ChaosRequestLog$$EnhancerByGuice$$1a9fb567:qtp1613092752-108)
      [2017-01-09 21:15:25,525] ERROR Exception while processing request (mesosphere.marathon.api.MarathonExceptionMapper$$EnhancerByGuice$$a8d33b3a:qtp1613092752-109)
      java.lang.UnsupportedOperationException: empty.reduceLeft
      	at scala.collection.TraversableOnce$class.reduceLeft(TraversableOnce.scala:180)
      	at scala.collection.AbstractTraversable.reduceLeft(Traversable.scala:104)
      	at scala.collection.TraversableOnce$class.reduce(TraversableOnce.scala:208)
      	at scala.collection.AbstractTraversable.reduce(Traversable.scala:104)
      	at mesosphere.marathon.api.v2.TasksResource$$anonfun$indexJson$1$stateMachine$macro$87$1.apply(TasksResource.scala:74)
      	at mesosphere.marathon.api.v2.TasksResource$$anonfun$indexJson$1$stateMachine$macro$87$1.apply(TasksResource.scala:53)
      	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32)
      	at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:121)
      	at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
      	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1253)
      	at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1346)
      	at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
      	at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
      

      This happens at https://github.com/mesosphere/marathon/blob/master/src/main/scala/mesosphere/marathon/api/v2/TasksResource.scala#L71, when marathon attempts to call reduce on an empty set.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              GitHub_jessicalucci Jessica Lucci (Inactive)
              Team:
              Orchestration Team
              Watchers:
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: