Index: /trunk/src/VBox/Main/include/MachineImpl.h
===================================================================
--- /trunk/src/VBox/Main/include/MachineImpl.h	(revision 49975)
+++ /trunk/src/VBox/Main/include/MachineImpl.h	(revision 49976)
@@ -791,7 +791,5 @@
     { return isSessionOpen(aMachine, aControl, true /* aAllowClosing */); }
 
-#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
     bool checkForSpawnFailure();
-#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
 
     HRESULT prepareRegister();
Index: /trunk/src/VBox/Main/src-server/ClientWatcher.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/ClientWatcher.cpp	(revision 49975)
+++ /trunk/src/VBox/Main/src-server/ClientWatcher.cpp	(revision 49976)
@@ -692,5 +692,4 @@
 #elif defined(VBOX_WITH_GENERIC_SESSION_WATCHER)
 
-    bool update = false;
     bool updateSpawned = false;
 
@@ -733,9 +732,14 @@
                 break;
 
-            if (RT_SUCCESS(rc) || update || updateSpawned)
+            /** @todo this quite big effort for catching machines in spawning
+             * state which can't be caught by the token mechanism (as the token
+             * can't be in the other process yet) could be eliminated if the
+             * reaping is made smarter, having cross-reference information
+             * from the pid to the corresponding machine object. Both cases do
+             * more or less the same thing anyway. */
+            if (RT_SUCCESS(rc) || updateSpawned)
             {
                 /* RT_SUCCESS(rc) means an update event is signaled */
 
-#if 0
                 // get reference to the machines list in VirtualBox
                 VirtualBox::MachinesOList &allMachines = that->mVirtualBox->getMachinesList();
@@ -744,8 +748,8 @@
                 AutoReadLock thatLock(allMachines.getLockHandle() COMMA_LOCKVAL_SRC_POS);
 
-                if (RT_SUCCESS(rc) || update)
-                {
-                    /* obtain a new set of opened machines */
-                    machines.clear();
+                if (RT_SUCCESS(rc) || updateSpawned)
+                {
+                    /* obtain a new set of spawned machines */
+                    spawnedMachines.clear();
 
                     for (MachinesOList::iterator it = allMachines.begin();
@@ -753,22 +757,4 @@
                          ++it)
                     {
-                        ComObjPtr<SessionMachine> sm;
-                        if ((*it)->isSessionOpenOrClosing(sm))
-                            machines.push_back(sm);
-                    }
-
-                    cnt = machines.size();
-                    LogFlowFunc(("UPDATE: direct session count = %d\n", cnt));
-                }
-
-                if (RT_SUCCESS(rc) || updateSpawned)
-                {
-                    /* obtain a new set of spawned machines */
-                    spawnedMachines.clear();
-
-                    for (MachinesOList::iterator it = allMachines.begin();
-                         it != allMachines.end();
-                         ++it)
-                    {
                         if ((*it)->isSessionSpawning())
                             spawnedMachines.push_back(*it);
@@ -779,21 +765,11 @@
                 }
 
+                NOREF(cnt);
                 // machines lock unwinds here
-#else
-                NOREF(cnt);
-#endif
-            }
-
-#if 0
-            update = false;
-            for (size_t i = 0; i < cnt; ++i)
-                update |= (machines[i])->checkForDeath();
+            }
 
             updateSpawned = false;
             for (size_t i = 0; i < cntSpawned; ++i)
                 updateSpawned |= (spawnedMachines[i])->checkForSpawnFailure();
-#else
-            NOREF(cntSpawned);
-#endif
 
             /* reap child processes */
Index: /trunk/src/VBox/Main/src-server/MachineImpl.cpp
===================================================================
--- /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 49975)
+++ /trunk/src/VBox/Main/src-server/MachineImpl.cpp	(revision 49976)
@@ -8213,4 +8213,6 @@
         /* restore the session state */
         mData->mSession.mState = SessionState_Unlocked;
+        alock.release();
+        mParent->addProcessToReap(pid);
         /* The failure may occur w/o any error info (from RPC), so provide one */
         return setError(VBOX_E_VM_ERROR,
@@ -8225,4 +8227,7 @@
     mData->mSession.mState = SessionState_Spawning;
     mData->mSession.mType = strFrontend;
+
+    alock.release();
+    mParent->addProcessToReap(pid);
 
     LogFlowThisFuncLeave();
@@ -8296,5 +8301,4 @@
 }
 
-#ifndef VBOX_WITH_GENERIC_SESSION_WATCHER
 /**
  * Called from the client watcher thread to check for unexpected client process
@@ -8390,5 +8394,4 @@
     return false;
 }
-#endif /* !VBOX_WITH_GENERIC_SESSION_WATCHER */
 
 /**
@@ -12985,6 +12988,6 @@
 
     // we need to lock this object in uninit() because the lock is shared
-    // with mPeer (as well as data we modify below). mParent->addProcessToReap()
-    // and others need mParent lock, and USB needs host lock.
+    // with mPeer (as well as data we modify below). mParent lock is needed
+    // by several calls to it, and USB needs host lock.
     AutoMultiWriteLock3 multilock(mParent, mParent->host(), this COMMA_LOCKVAL_SRC_POS);
 
@@ -13045,14 +13048,4 @@
         mConsoleTaskData.mSnapshot->uninit();
         releaseSavedStateFile(strStateFile, NULL /* pSnapshotToIgnore */ );
-    }
-
-    if (!mData->mSession.mType.isEmpty())
-    {
-        /* mType is not null when this machine's process has been started by
-         * Machine::LaunchVMProcess(), therefore it is our child.  We
-         * need to queue the PID to reap the process (and avoid zombies on
-         * Linux). */
-        Assert(mData->mSession.mPID != NIL_RTPROCESS);
-        mParent->addProcessToReap(mData->mSession.mPID);
     }
 
