[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - 4 commits - loleaflet/Makefile loolwsd/LOOLWSD.cpp loolwsd/LOOLWSD.hpp

Jan Holesovsky kendy at collabora.com
Thu Feb 4 18:24:34 UTC 2016


 loleaflet/Makefile  |    2 +-
 loolwsd/LOOLWSD.cpp |   34 ++++++++++++++++++++++------------
 loolwsd/LOOLWSD.hpp |    2 +-
 3 files changed, 24 insertions(+), 14 deletions(-)

New commits:
commit 52afb6a69d9c728e2a42776fa043f314e27165ce
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Feb 4 19:22:51 2016 +0100

    loolwsd: Increase the maximum number of sessions to 1024.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index 589c1a2..a1b9a48 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -148,6 +148,9 @@ using Poco::Random;
 using Poco::NamedMutex;
 using Poco::URI;
 
+// The maximum number of client connections we can accept.
+constexpr int MAX_SESSIONS = 1024;
+
 class QueueHandler: public Runnable
 {
 public:
@@ -1423,7 +1426,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
 
     // Start a server listening on the port for clients
     ServerSocket svs(portNumber, _numPreSpawnedChildren*10);
-    ThreadPool threadPool(_numPreSpawnedChildren*2, _numPreSpawnedChildren*5);
+    ThreadPool threadPool(_numPreSpawnedChildren*2, MAX_SESSIONS);
     HTTPServer srv(new RequestHandlerFactory(), threadPool, svs, new HTTPServerParams);
 
     srv.start();
@@ -1431,7 +1434,7 @@ int LOOLWSD::main(const std::vector<std::string>& /*args*/)
     // And one on the port for child processes
     SocketAddress addr2("127.0.0.1", MASTER_PORT_NUMBER);
     ServerSocket svs2(addr2, _numPreSpawnedChildren);
-    ThreadPool threadPool2(_numPreSpawnedChildren*2, _numPreSpawnedChildren*5);
+    ThreadPool threadPool2(_numPreSpawnedChildren*2, MAX_SESSIONS);
     HTTPServer srv2(new RequestHandlerFactory(), threadPool2, svs2, new HTTPServerParams);
 
     srv2.start();
commit 56ab0c23e28a6d7d435c6464ed203d0ce5c9cb23
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Feb 4 18:59:44 2016 +0100

    loolwsd: Improved the restarting strategy.
    
    Try to restart not only when a process terminated successfully, but when there
    was a failure too.

diff --git a/loolwsd/LOOLWSD.cpp b/loolwsd/LOOLWSD.cpp
index d8070e0..589c1a2 100644
--- a/loolwsd/LOOLWSD.cpp
+++ b/loolwsd/LOOLWSD.cpp
@@ -1215,20 +1215,25 @@ int LOOLWSD::createComponent()
     return Application::EXIT_OK;
 }
 
-bool LOOLWSD::startupComponent(int nComponents)
+bool LOOLWSD::startupComponent(int nComponents, int* pSuccessfullyStarted)
 {
     for (int nCntr = nComponents; nCntr; nCntr--)
     {
         if (createComponent() < 0)
+        {
+            if (pSuccessfullyStarted)
+                *pSuccessfullyStarted = nComponents - nCntr;
             return false;
+        }
     }
+
+    if (pSuccessfullyStarted)
+        *pSuccessfullyStarted = nComponents;
     return true;
 }
 
 void LOOLWSD::desktopMain()
 {
-    int nChildExitCode = Application::EXIT_OK;
-
 #ifdef __linux
     if (prctl(PR_SET_NAME, reinterpret_cast<unsigned long>("loolbroker"), 0, 0, 0) != 0)
         std::cout << Util::logPrefix() << "Cannot set thread name :" << strerror(errno) << std::endl;
@@ -1252,14 +1257,11 @@ void LOOLWSD::desktopMain()
                 {
                     if (WIFEXITED(status))
                     {
-                        nChildExitCode = Util::getChildStatus(WEXITSTATUS(status));
                         std::cout << Util::logPrefix() << "One of our known child processes died :" << std::to_string(pid)
                                   << " exit code " << std::to_string(WEXITSTATUS(status)) << std::endl;
                     }
-                    else
-                    if (WIFSIGNALED(status))
+                    else if (WIFSIGNALED(status))
                     {
-                        nChildExitCode = Util::getSignalStatus(WTERMSIG(status));
                         std::cout << Util::logPrefix() << "One of our known child processes died :" << std::to_string(pid)
                                   << " signal code " << strsignal(WTERMSIG(status)) << std::endl;
                     }
@@ -1305,11 +1307,17 @@ void LOOLWSD::desktopMain()
             if (MasterProcessSession::_childProcesses.size() + toSpawn < _numPreSpawnedChildren)
                 toSpawn = _numPreSpawnedChildren - MasterProcessSession::_childProcesses.size();
 
-            if (toSpawn > 0 && nChildExitCode == Application::EXIT_OK)
+            if (toSpawn > 0)
             {
                 std::cout << Util::logPrefix() << "Create child session, fork new ones: " << toSpawn << std::endl;
-                if (!startupComponent(toSpawn))
+                int spawned;
+                if (!startupComponent(toSpawn, &spawned))
+                {
+                    _namedMutexLOOL.lock();
+                    reinterpret_cast<size_t*>(_sharedForkChild.begin())[0] += toSpawn - spawned;
+                    _namedMutexLOOL.unlock();
                     break;
+                }
             }
         }
 
@@ -1318,7 +1326,6 @@ void LOOLWSD::desktopMain()
         {
             timeoutCounter = 0;
             sleep(MAINTENANCE_INTERVAL);
-            nChildExitCode = Application::EXIT_OK;
         }
     }
 
diff --git a/loolwsd/LOOLWSD.hpp b/loolwsd/LOOLWSD.hpp
index 8d87cb0..b707e73 100644
--- a/loolwsd/LOOLWSD.hpp
+++ b/loolwsd/LOOLWSD.hpp
@@ -73,7 +73,7 @@ private:
     void desktopMain();
 
     /// Call createComponent() nComponents-times.
-    bool startupComponent(int nComponents);
+    bool startupComponent(int nComponents, int* pSuccessfullyStarted = nullptr);
     void startupDesktop(int nDesktop);
     int  createComponent();
     int  createDesktop();
commit cdadf301dd80ace808168192518b7fe4b0c5cf7b
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Feb 3 15:56:57 2016 +0100

    loleaflet: bump version after tarball

diff --git a/loleaflet/Makefile b/loleaflet/Makefile
index 1660add..bdb40cf 100644
--- a/loleaflet/Makefile
+++ b/loleaflet/Makefile
@@ -3,7 +3,7 @@
 # ("micro") part: Between releases odd, even for releases (no other
 # changes inbetween).
 
-VERSION=1.4.44
+VERSION=1.4.45
 
 # Version number of the bundled 'draw' thing
 DRAW_VERSION=0.2.4
commit f864ee8a7cfbc0bcef17d7c907d91619953a8b74
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Wed Feb 3 15:56:04 2016 +0100

    loleaflet: bump version before tarball

diff --git a/loleaflet/Makefile b/loleaflet/Makefile
index 0bff2be..1660add 100644
--- a/loleaflet/Makefile
+++ b/loleaflet/Makefile
@@ -3,7 +3,7 @@
 # ("micro") part: Between releases odd, even for releases (no other
 # changes inbetween).
 
-VERSION=1.4.43
+VERSION=1.4.44
 
 # Version number of the bundled 'draw' thing
 DRAW_VERSION=0.2.4


More information about the Libreoffice-commits mailing list