Index: /trunk/src/VBox/Installer/linux/vboxweb-service.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxweb-service.sh	(revision 60531)
+++ /trunk/src/VBox/Installer/linux/vboxweb-service.sh	(revision 60532)
@@ -168,4 +168,6 @@
         killproc $binary
         RETVAL=$?
+        # Be careful: wait 1 second, making sure that everything is cleaned up.
+        sleep 1
         if ! pidof $binary > /dev/null 2>&1; then
             rm -f $PIDFILE
Index: /trunk/src/VBox/Installer/solaris/smf-vboxwebsrv.sh
===================================================================
--- /trunk/src/VBox/Installer/solaris/smf-vboxwebsrv.sh	(revision 60531)
+++ /trunk/src/VBox/Installer/solaris/smf-vboxwebsrv.sh	(revision 60532)
@@ -125,4 +125,6 @@
         # Kill service contract
         smf_kill_contract $2 TERM 1
+        # Be careful: wait 1 second, making sure that everything is cleaned up.
+        smf_kill_contract $2 TERM 1
     ;;
     *)
Index: /trunk/src/VBox/Main/webservice/vboxweb.cpp
===================================================================
--- /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 60531)
+++ /trunk/src/VBox/Main/webservice/vboxweb.cpp	(revision 60532)
@@ -908,8 +908,33 @@
         g_pSoapQ = new SoapQ(&soap);
 
-        for (uint64_t i = 1; g_fKeepRunning; i++)
-        {
+        uint64_t cAccepted = 1;
+        while (g_fKeepRunning)
+        {
+            struct timeval timeout;
+            fd_set fds;
+            int rv;
+            for (;;)
+            {
+                timeout.tv_sec = 60;
+                timeout.tv_usec = 0;
+                FD_ZERO(&fds);
+                FD_SET(soap.master, &fds);
+                rv = select((int)soap.master + 1, &fds, &fds, &fds, &timeout);
+                if (rv > 0)
+                    break; // work is waiting
+                else if (rv == 0)
+                    continue; // timeout, not necessary to bother gsoap
+                else // r < 0, errno
+                {
+                    if (soap_socket_errno(soap.master) == SOAP_EINTR)
+                        rv = 0; // re-check if we should terminate
+                    break;
+                }
+            }
+            if (rv == 0)
+                continue;
+
             // call gSOAP to handle incoming SOAP connection
-            soap.accept_timeout = 10;
+            soap.accept_timeout = -1; // 1usec timeout, actual waiting is above
             s = soap_accept(&soap);
             if (!soap_valid_socket(s))
@@ -923,5 +948,6 @@
             // pick up the job
             size_t cItemsOnQ = g_pSoapQ->add(s);
-            LogRel(("Request %llu on socket %d queued for processing (%d items on Q)\n", i, s, cItemsOnQ));
+            LogRel(("Request %llu on socket %d queued for processing (%d items on Q)\n", cAccepted, s, cItemsOnQ));
+            cAccepted++;
         }
 
@@ -1321,4 +1347,5 @@
 #else
     signal(SIGINT,   websrvSignalHandler);
+    signal(SIGTERM,  websrvSignalHandler);
 # ifdef SIGBREAK
     signal(SIGBREAK, websrvSignalHandler);
@@ -1346,4 +1373,5 @@
 #else
     signal(SIGINT,   SIG_DFL);
+    signal(SIGTERM,  SIG_DFL);
 # ifdef SIGBREAK
     signal(SIGBREAK, SIG_DFL);
@@ -1351,7 +1379,11 @@
 #endif
 
+    RTThreadPoke(threadQPumper);
     RTThreadWait(threadQPumper, 30000, NULL);
     if (threadWatchdog != NIL_RTTHREAD)
+    {
+        RTThreadPoke(threadWatchdog);
         RTThreadWait(threadWatchdog, g_iWatchdogCheckInterval * 1000 + 10000, NULL);
+    }
 
     /* VirtualBoxClient events unregistration. */
