From 0fb5c64ff7ba45d52f9b3838843117c7f80bcc7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gast=C3=B3n=20Kleiman?= Date: Tue, 18 Aug 2015 14:33:07 +0200 Subject: [PATCH] Set the hostname in the framework information proto Due to a bug in Mesos < 0.24.0, Marathon users have observed JVM crashes when the framework the host's hostname is nor resolvable (https://issues.apache.org/jira/browse/MESOS-3145). This change works around the problem by setting the hostname in the Framework Information proto. --- .../chronos/scheduler/config/SchedulerConfiguration.scala | 4 ++-- .../chronos/scheduler/mesos/SchedulerDriverBuilder.scala | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/scala/org/apache/mesos/chronos/scheduler/config/SchedulerConfiguration.scala b/src/main/scala/org/apache/mesos/chronos/scheduler/config/SchedulerConfiguration.scala index 097ad060e..9778c4673 100644 --- a/src/main/scala/org/apache/mesos/chronos/scheduler/config/SchedulerConfiguration.scala +++ b/src/main/scala/org/apache/mesos/chronos/scheduler/config/SchedulerConfiguration.scala @@ -37,8 +37,8 @@ trait SchedulerConfiguration extends ScallopConf { descr = "The list of ZooKeeper servers for storing state", default = Some("localhost:2181")) lazy val hostname = opt[String]("hostname", - descr = "The advertised hostname stored in ZooKeeper so another standby " + - "host can redirect to this elected leader", + descr = "The advertised hostname, stored in ZooKeeper so another standby " + + "host can redirect to this elected leader and also sent to the Mesos Master", default = Some(java.net.InetAddress.getLocalHost.getHostName)) lazy val leaderMaxIdleTimeMs = opt[Int]("leader_max_idle_time", descr = "The look-ahead time for scheduling tasks in milliseconds", diff --git a/src/main/scala/org/apache/mesos/chronos/scheduler/mesos/SchedulerDriverBuilder.scala b/src/main/scala/org/apache/mesos/chronos/scheduler/mesos/SchedulerDriverBuilder.scala index 5827dae04..d48074692 100644 --- a/src/main/scala/org/apache/mesos/chronos/scheduler/mesos/SchedulerDriverBuilder.scala +++ b/src/main/scala/org/apache/mesos/chronos/scheduler/mesos/SchedulerDriverBuilder.scala @@ -47,6 +47,7 @@ class SchedulerDriverBuilder { .setRole(config.mesosRole()) .setFailoverTimeout(config.failoverTimeoutSeconds()) .setUser(config.user()) + .setHostname(config.hostname()) // Set the ID, if provided frameworkId.foreach(frameworkInfoBuilder.setId)