You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by al...@apache.org on 2018/10/05 06:39:06 UTC

[mesos] branch master updated (6654b26 -> 2588d79)

This is an automated email from the ASF dual-hosted git repository.

alexr pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git.


    from 6654b26  Updated Docker library to avoid 'os::killtree()' when discarding.
     new 8f400c3  Put `TerminateEvent` at the end of the queue in the Mesos library.
     new 2588d79  Waited for TEARDOWN response in v1 Java scheduler shim.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp     | 19 ++++++++++++++++++-
 src/scheduler/scheduler.cpp                           |  7 ++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)


[mesos] 02/02: Waited for TEARDOWN response in v1 Java scheduler shim.

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 2588d79eebb755ed8b1dc19374c385f72daf30e4
Author: Alexander Rukletsov <al...@apache.org>
AuthorDate: Thu Sep 27 15:20:52 2018 +0200

    Waited for TEARDOWN response in v1 Java scheduler shim.
    
    Destruction of the library is not always under our control. For
    example, the JVM can call JNI `finalize()` if the Java scheduler
    nullifies its reference to the V1Mesos library immediately after
    sending `TEARDOWN`. We want to make sure that `TEARDOWN` is sent
    before the Mesos library is destructed.
    
    Review: https://reviews.apache.org/r/68866
---
 .../jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp     | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/java/jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp b/src/java/jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp
index 2a5fbd7..e59f364 100644
--- a/src/java/jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp
+++ b/src/java/jni/org_apache_mesos_v1_scheduler_V1Mesos.cpp
@@ -285,7 +285,24 @@ JNIEXPORT void JNICALL Java_org_apache_mesos_v1_scheduler_V1Mesos_send
     return;
   }
 
-  mesos->mesos->send(call);
+  // Destruction of the library is not always under our control. For example,
+  // the JVM can call JNI `finalize()` if the Java scheduler nullifies its
+  // reference to the V1Mesos library immediately after sending `TEARDOWN`,
+  // see MESOS-9274.
+  //
+  // We want to make sure that the `TEARDOWN` message is sent before the
+  // scheduler and the Mesos library are destructed (garbage collected).
+  // However we don't want to block forever if the message is dropped.
+  //
+  // TODO(alexr): Consider adding general support for `call()`.
+  if (call.type() == Call::TEARDOWN) {
+    const Duration timeout = Minutes(10);
+    bool timedout = !mesos->mesos->call(call).await(timeout);
+    LOG_IF(ERROR, timedout)
+      << "Received no response to call " << call.type() << " for " << timeout;
+  } else {
+    mesos->mesos->send(call);
+  }
 }
 
 


[mesos] 01/02: Put `TerminateEvent` at the end of the queue in the Mesos library.

Posted by al...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

alexr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git

commit 8f400c3e5abe0fa1810a6efd56bc3fecabf1bbd3
Author: Alexander Rukletsov <al...@apache.org>
AuthorDate: Thu Sep 27 15:20:01 2018 +0200

    Put `TerminateEvent` at the end of the queue in the Mesos library.
    
    This is to ensure all pending dispatches are processed. However
    multistage events, e.g., `Call`, might still be dropped, because
    a continuation (stage) of such event can be dispatched after the
    termination event.
    
    Review: https://reviews.apache.org/r/68865
---
 src/scheduler/scheduler.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/scheduler/scheduler.cpp b/src/scheduler/scheduler.cpp
index 4711529..cb24ba9 100644
--- a/src/scheduler/scheduler.cpp
+++ b/src/scheduler/scheduler.cpp
@@ -1038,7 +1038,12 @@ void Mesos::reconnect()
 void Mesos::stop()
 {
   if (process != nullptr) {
-    terminate(process);
+    // We pass 'false' here to add the termination event at the end of the
+    // `MesosProcess` queue. This is to ensure all pending dispatches are
+    // processed. However multistage events, e.g., `Call`, might still be
+    // dropped, because a continuation (stage) of such event can be dispatched
+    // after the termination event, see MESOS-9274.
+    terminate(process, false);
     wait(process);
 
     delete process;