You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2017/08/30 06:49:06 UTC
mesos git commit: Added some logging and checks for detecting
incorrect libprocess usage.
Repository: mesos
Updated Branches:
refs/heads/master 3be138715 -> f7ab29936
Added some logging and checks for detecting incorrect libprocess usage.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/f7ab2993
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/f7ab2993
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/f7ab2993
Branch: refs/heads/master
Commit: f7ab29936fb1bbca3c3812cc5bb274aaca10b298
Parents: 3be1387
Author: Benjamin Hindman <be...@gmail.com>
Authored: Tue Aug 29 23:48:11 2017 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Tue Aug 29 23:48:50 2017 -0700
----------------------------------------------------------------------
3rdparty/libprocess/src/process.cpp | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/f7ab2993/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index dcd9c67..afa5353 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3209,6 +3209,18 @@ UPID ProcessManager::spawn(ProcessBase* process, bool manage)
{
CHECK(process != nullptr);
+ if (process->state.load() != ProcessBase::State::BOTTOM) {
+ LOG(WARNING)
+ << "Attempted to spawn a process (" << process->self()
+ << ") that has already been initialized";
+
+ if (manage) {
+ delete process;
+ }
+
+ return UPID();
+ }
+
// If the `ProcessManager` is cleaning itself up, no further processes
// may be spawned.
if (finalizing.load()) {
@@ -3225,7 +3237,14 @@ UPID ProcessManager::spawn(ProcessBase* process, bool manage)
synchronized (processes_mutex) {
if (processes.count(process->pid.id) > 0) {
- VLOG(1) << "Attempting to spawn already spawned process " << process->pid;
+ LOG(WARNING)
+ << "Attempted to spawn already running process " << process->pid;
+
+ // TODO(benh): we should be deleting `process` here, this is a
+ // long standing bug. This isn't straightforward because we
+ // can't delete it within the `synchronized (processes_mutex)`
+ // block.
+
return UPID();
} else {
processes[process->pid.id] = process;
@@ -3783,7 +3802,11 @@ ProcessBase::ProcessBase(const string& id)
}
-ProcessBase::~ProcessBase() {}
+ProcessBase::~ProcessBase()
+{
+ CHECK(state.load() == ProcessBase::State::BOTTOM ||
+ state.load() == ProcessBase::State::TERMINATING);
+}
template <>