[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.hpp

2020-04-18 Thread Tor Lillqvist (via logerrit)
 wsd/DocumentBroker.hpp |6 --
 wsd/LOOLWSD.hpp|8 
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 7a416cbf0a3cf6724d5ff21128ed46cb82c42a1a
Author: Tor Lillqvist 
AuthorDate: Sat Apr 18 16:44:50 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Sat Apr 18 16:34:49 2020 +0200

Clarify what ChildProcess and WSProcess are

Change-Id: I13dd37c840d2c8b811bb56614fbc9f8ee2e44d40
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92475
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Tor Lillqvist 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index d161be4aa..99391c0d0 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -58,8 +58,10 @@ public:
 
 #include "LOOLWSD.hpp"
 
-/// Represents a new LOK child that is read
-/// to host a document.
+/// A ChildProcess object represents a KIT process that hosts a document and 
manipulates the
+/// document using the LibreOfficeKit API. It isn't actually a child of the 
WSD process, but a
+/// grandchild. The comments loosely talk about "child" anyway.
+
 class ChildProcess : public WSProcess
 {
 public:
diff --git a/wsd/LOOLWSD.hpp b/wsd/LOOLWSD.hpp
index 368b58076..c391cc055 100644
--- a/wsd/LOOLWSD.hpp
+++ b/wsd/LOOLWSD.hpp
@@ -38,10 +38,10 @@ std::shared_ptr getNewChild_Blocks(
  const std::string& uri
 #endif
  );
-// This is common code used to setup as socket to both
-// forkit and child document processes via a websocket.
-// In general, a WSProcess instance represents a child
-// process with which we can communicate through websocket.
+// A WSProcess object in the WSD process represents a descendant process, 
either the direct child
+// process FORKIT or a grandchild KIT process, with which the WSD process 
communicates through a
+// WebSocket.
+
 class WSProcess
 {
 public:
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2020-04-18 Thread Tor Lillqvist (via logerrit)
 wsd/DocumentBroker.hpp |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 21dfba7db728c72d03e2d8009e595b60b6efa1c8
Author: Tor Lillqvist 
AuthorDate: Sat Apr 18 10:41:39 2020 +0300
Commit: Tor Lillqvist 
CommitDate: Sat Apr 18 10:41:39 2020 +0300

Clarify what a DocumentBroker is and in which process they exist

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 42fc82bbb..6f37607f7 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -74,6 +74,7 @@ public:
 WSProcess("ChildProcess", pid, socket, 
std::make_shared(socket, request)),
 _jailId(jailId)
 {
+LOG_TRC("==> new ChildProcess");
 }
 
 
@@ -92,10 +93,13 @@ private:
 
 class ClientSession;
 
-/// DocumentBroker is responsible for setting up a document
-/// in jail and brokering loading it from Storage
-/// and saving it back.
+/// DocumentBroker is responsible for setting up a document in jail and 
brokering loading it from
+/// Storage and saving it back.
+
 /// Contains URI, physical path, etc.
+
+/// There is one DocumentBroker object in the WSD process for each document 
that is open (in 1..n sessions).
+
 class DocumentBroker : public std::enable_shared_from_this
 {
 class DocumentBrokerPoll;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2020-02-12 Thread Michael Meeks (via logerrit)
 wsd/DocumentBroker.hpp |   13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

New commits:
commit faee2bdb24bcc77b879e5b9329889209c113f4a1
Author: Michael Meeks 
AuthorDate: Thu Feb 13 00:23:43 2020 +
Commit: Michael Meeks 
CommitDate: Thu Feb 13 00:33:05 2020 +

Revert "Fix removal of kit procs when they are blocked"

This reverts commit 3046c5748bb54b16738aa5a7ee5e90b9420d68ac.

This breaks mobile apps for now. Apparently the 'close'
forces a different ordering than expected on the Child.

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 8b2b42551..890e89e38 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -119,23 +119,14 @@ public:
 
 // Shutdown the socket.
 if (_ws)
-{
 _ws->shutdown();
-// If socket was shutdown and buffers cleared then there's no
-// reason to keep the object. This is crucial for 
DocumentBroker
-// to be considered as not alive and associated kit process
-// terminated in cleanupDocBrokers. Otherwise if kit process
-// hangs then the asociated DocumentBroker object won't be
-// removed and kit process won't be forcefully terminated. This
-// is in conjunction with not clearing _pid data member which
-// is needed later in call to terminate().
-_ws.reset();
-}
 }
 catch (const std::exception& ex)
 {
 LOG_ERR("Error while closing child process: " << ex.what());
 }
+
+_pid = -1;
 }
 
 /// Kill or abandon the child.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2020-02-12 Thread Gabriel Masei (via logerrit)
 wsd/DocumentBroker.hpp |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 3046c5748bb54b16738aa5a7ee5e90b9420d68ac
Author: Gabriel Masei 
AuthorDate: Tue Feb 11 17:51:20 2020 +0200
Commit: Andras Timar 
CommitDate: Wed Feb 12 16:28:10 2020 +0100

Fix removal of kit procs when they are blocked

Change-Id: Ifa2a2a56a305e33bb07ad622fce14f0e8b3e83eb
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/88464
Reviewed-by: Michael Meeks 
Tested-by: Andras Timar 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 890e89e38..8b2b42551 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -119,14 +119,23 @@ public:
 
 // Shutdown the socket.
 if (_ws)
+{
 _ws->shutdown();
+// If socket was shutdown and buffers cleared then there's no
+// reason to keep the object. This is crucial for 
DocumentBroker
+// to be considered as not alive and associated kit process
+// terminated in cleanupDocBrokers. Otherwise if kit process
+// hangs then the asociated DocumentBroker object won't be
+// removed and kit process won't be forcefully terminated. This
+// is in conjunction with not clearing _pid data member which
+// is needed later in call to terminate().
+_ws.reset();
+}
 }
 catch (const std::exception& ex)
 {
 LOG_ERR("Error while closing child process: " << ex.what());
 }
-
-_pid = -1;
 }
 
 /// Kill or abandon the child.
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/Storage.cpp

2019-11-29 Thread Tor Lillqvist (via logerrit)
 wsd/DocumentBroker.hpp |2 ++
 wsd/Storage.cpp|   10 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 29b603a34f9dfbf4ecd9d504fd2836472fa3c9a5
Author: Tor Lillqvist 
AuthorDate: Thu Nov 28 18:09:58 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Nov 29 12:12:30 2019 +0100

Fix build for MOBILEAPP

No Admin.hpp needed (which would cause a conflicting definitions of a
class called Document when compiling Kit.cpp).

No locks "supported" in the way the code expects for WOPI-like things.

Change-Id: Ie43311af054f2940576ce9b2b13520f24887628e
Reviewed-on: https://gerrit.libreoffice.org/84018
Reviewed-by: Michael Meeks 
Tested-by: Tor Lillqvist 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 91daee6a2..19c88e4c4 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -33,7 +33,9 @@
 
 #include "common/SigUtil.hpp"
 
+#if !MOBILEAPP
 #include "Admin.hpp"
+#endif
 
 // Forwards.
 class PrisonerRequestDispatcher;
diff --git a/wsd/Storage.cpp b/wsd/Storage.cpp
index e8b769d3f..484751352 100644
--- a/wsd/Storage.cpp
+++ b/wsd/Storage.cpp
@@ -462,14 +462,20 @@ std::map GetQueryParams(const 
Poco::URI& uri)
 
 } // anonymous namespace
 
+#endif // !MOBILEAPP
+
 void LockContext::initSupportsLocks()
 {
+#if MOBILEAPP
+_supportsLocks = false;
+#else
 if (_supportsLocks)
 return;
 
 // first time token setup
 _supportsLocks = true;
 _lockToken = "lool-lock" + Util::rng::getHexString(8);
+#endif
 }
 
 bool LockContext::needsRefresh(const std::chrono::steady_clock::time_point 
) const
@@ -490,6 +496,8 @@ void LockContext::dumpState(std::ostream& os)
 os << "last locked: " << Util::getSteadyClockAsString(_lastLockTime) 
<< "\n";
 }
 
+#if !MOBILEAPP
+
 std::unique_ptr WopiStorage::getWOPIFileInfo(const 
Authorization& auth, LockContext )
 {
 // update the access_token to the one matching to the session
@@ -1100,6 +1108,6 @@ StorageBase::SaveResult 
WebDAVStorage::saveLocalFileToStorage(
 return StorageBase::SaveResult(StorageBase::SaveResult::OK);
 }
 
-#endif
+#endif // !MOBILEAPP
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2019-11-21 Thread Miklos Vajna (via logerrit)
 wsd/DocumentBroker.hpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 0077b4ae6a7ef6d778186e836b362393ad3608a9
Author: Miklos Vajna 
AuthorDate: Thu Nov 21 17:28:19 2019 +0100
Commit: Miklos Vajna 
CommitDate: Thu Nov 21 17:42:08 2019 +0100

wsd: fix -Werror,-Wmismatched-tags

If it's a struct, then forward-declare as struct, not as class.

Change-Id: Ia78d7c1bee222bd1f499fe93aaf2dda9b81f423a

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 8641fe123..5c0a83b07 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -36,7 +36,7 @@
 // Forwards.
 class PrisonerRequestDispatcher;
 class DocumentBroker;
-class LockContext;
+struct LockContext;
 class StorageBase;
 class TileCache;
 class Message;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2019-10-28 Thread Ashod Nakashian (via logerrit)
 wsd/DocumentBroker.hpp |   40 ++--
 1 file changed, 22 insertions(+), 18 deletions(-)

New commits:
commit ae8d28478b11b9228201f5157038c7632dc0086f
Author: Ashod Nakashian 
AuthorDate: Sun Sep 29 23:32:12 2019 -0400
Commit: Michael Meeks 
CommitDate: Mon Oct 28 10:47:10 2019 +0100

wsd: reduce public surface area of DocumentBroker

Reviewed-on: https://gerrit.libreoffice.org/80323
Reviewed-by: Andras Timar 
Tested-by: Andras Timar 
(cherry picked from commit 46bdda0186f98eb27d15507ce3cc63b64a106942)

Change-Id: If74bd1967f3725e81a6e381e883eac86104f9f40
Reviewed-on: https://gerrit.libreoffice.org/81561
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 5ab980a75..4d66ffae3 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -240,9 +240,6 @@ public:
 /// Thread safe termination of this broker if it has a lingering thread
 void joinThread();
 
-/// Loads a document from the public URI into the jail.
-bool load(const std::shared_ptr& session, const 
std::string& jailId);
-bool isLoaded() const { return _isLoaded; }
 void setLoaded();
 
 bool isDocumentChangedInStorage() { return _documentChangedInStorage; }
@@ -317,8 +314,6 @@ public:
const std::shared_ptr& 
session);
 void sendRequestedTiles(const std::shared_ptr& session);
 void cancelTileRequests(const std::shared_ptr& session);
-void handleTileResponse(const std::vector& payload);
-void handleTileCombinedResponse(const std::vector& payload);
 
 enum ClipboardRequest {
 CLIP_REQUEST_SET,
@@ -343,26 +338,13 @@ public:
 /// Ask the document broker to close. Makes sure that the document is 
saved.
 void closeDocument(const std::string& reason);
 
-/// Called by the ChildProcess object to notify
-/// that it has terminated on its own.
-/// This happens either when the child exists
-/// or upon failing to process an incoming message.
-void childSocketTerminated();
-
 /// Get the PID of the associated child process
 Poco::Process::PID getPid() const { return _childProcess ? 
_childProcess->getPid() : 0; }
 
 std::unique_lock getLock() { return 
std::unique_lock(_mutex); }
-std::unique_lock getDeferredLock() { return 
std::unique_lock(_mutex, std::defer_lock); }
 
 void updateLastActivityTime();
 
-std::size_t getIdleTimeSecs() const
-{
-const auto duration = (std::chrono::steady_clock::now() - 
_lastActivityTime);
-return 
std::chrono::duration_cast(duration).count();
-}
-
 /// Sends the .uno:Save command to LoKit.
 bool sendUnoSave(const std::string& sessionId, bool dontTerminateEdit = 
true,
  bool dontSaveIfUnmodified = true, bool isAutosave = false,
@@ -382,6 +364,28 @@ public:
 
 private:
 
+/// Loads a document from the public URI into the jail.
+bool load(const std::shared_ptr& session, const 
std::string& jailId);
+bool isLoaded() const { return _isLoaded; }
+
+std::size_t getIdleTimeSecs() const
+{
+const auto duration = (std::chrono::steady_clock::now() - 
_lastActivityTime);
+return 
std::chrono::duration_cast(duration).count();
+}
+
+std::unique_lock getDeferredLock() { return 
std::unique_lock(_mutex, std::defer_lock); }
+
+/// Called by the ChildProcess object to notify
+/// that it has terminated on its own.
+/// This happens either when the child exists
+/// or upon failing to process an incoming message.
+void childSocketTerminated();
+void handleTileResponse(const std::vector& payload);
+void handleDialogPaintResponse(const std::vector& payload, bool 
child);
+void handleTileCombinedResponse(const std::vector& payload);
+void handleDialogRequest(const std::string& dialogCmd);
+
 /// Shutdown all client connections with the given reason.
 void shutdownClients(const std::string& closeReason);
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2019-02-08 Thread Libreoffice Gerrit user
 wsd/DocumentBroker.hpp |1 -
 1 file changed, 1 deletion(-)

New commits:
commit fb29e3989916d27208d318097f21626a31403c8d
Author: Tor Lillqvist 
AuthorDate: Fri Feb 8 15:47:35 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Feb 8 15:47:35 2019 +0200

There is no DocumentBroker::handleDialogPaintResponse() either

Change-Id: I84daa5da83b9d27c8bedadeb8a5d660573e00eb4

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 75fc05dc4..c9865a7eb 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -311,7 +311,6 @@ public:
 void sendRequestedTiles(const std::shared_ptr& session);
 void cancelTileRequests(const std::shared_ptr& session);
 void handleTileResponse(const std::vector& payload);
-void handleDialogPaintResponse(const std::vector& payload, bool 
child);
 void handleTileCombinedResponse(const std::vector& payload);
 
 bool isMarkedToDestroy() const { return _markToDestroy || _stop; }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2019-02-08 Thread Libreoffice Gerrit user
 wsd/DocumentBroker.hpp |1 -
 1 file changed, 1 deletion(-)

New commits:
commit 214fb20e7f6b2fc34d24c3d53fc696044f8694e6
Author: Tor Lillqvist 
AuthorDate: Fri Feb 8 15:38:36 2019 +0200
Commit: Tor Lillqvist 
CommitDate: Fri Feb 8 15:38:40 2019 +0200

There is no DocumentBroker::handleDialogRequest()

Change-Id: Ide3f00e898dd1d3dfde62f1eea1728beb6067b04

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 3d47c722d..75fc05dc4 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -306,7 +306,6 @@ public:
 void invalidateTiles(const std::string& tiles);
 void handleTileRequest(TileDesc& tile,
const std::shared_ptr& session);
-void handleDialogRequest(const std::string& dialogCmd);
 void handleTileCombinedRequest(TileCombined& tileCombined,
const std::shared_ptr& 
session);
 void sendRequestedTiles(const std::shared_ptr& session);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2018-02-01 Thread Pranav Kant
 wsd/DocumentBroker.hpp |3 ---
 wsd/LOOLWSD.cpp|3 +--
 2 files changed, 1 insertion(+), 5 deletions(-)

New commits:
commit 5bd124499ce03d2c0b30165c99468f7a00646648
Author: Pranav Kant 
Date:   Fri Feb 2 00:36:53 2018 +0530

wsd: Bin superfluous public method

Passing the reason to stop() method also does the same thing.

Change-Id: I16b648495382c14f31839acca815835df76d8dca

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 1571e426..a398e701 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -349,9 +349,6 @@ public:
 /// Sends a message to all sessions
 void broadcastMessage(const std::string& message);
 
-/// Sets the reason for closing document;
-void setCloseReason(const std::string& closeReason) { _closeReason = 
closeReason; }
-
 private:
 
 /// Shutdown all client connections with the given reason.
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index eecb793f..34482638 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1555,8 +1555,7 @@ private:
 {
 auto lock = docBroker->getLock();
 docBroker->assertCorrectThread();
-docBroker->setCloseReason("docdisconnected");
-docBroker->stop("Lost connection with LOKit.");
+docBroker->stop("docisdisconnected");
 }
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-03-12 Thread Ashod Nakashian
 wsd/DocumentBroker.hpp |6 ++
 wsd/LOOLWSD.cpp|6 +++---
 2 files changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 8901fcf074da289bfc7063eff0e21175f439ae3a
Author: Ashod Nakashian 
Date:   Sun Mar 12 19:18:12 2017 -0400

wsd: ChildProcess doesn't need friends

Change-Id: I1911920c9b49adecac4ea4d8fc4b0830687b80c7
Reviewed-on: https://gerrit.libreoffice.org/35121
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 9836872..8d7eb2a 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -60,8 +60,6 @@ public:
 /// to host a document.
 class ChildProcess
 {
-// FIXME: urk ...
-friend class PrisonerRequestDispatcher;
 public:
 /// @param pid is the process ID of the child.
 /// @param socket is the underlying Sockeet to the child.
@@ -92,11 +90,11 @@ public:
 }
 
 void setDocumentBroker(const std::shared_ptr& docBroker);
+std::shared_ptr getDocumentBroker() const { return 
_docBroker.lock(); }
 
 void stop()
 {
-// FIXME: stop !?
-LOG_ERR("What do we do for stop?");
+// Request the child to exit.
 try
 {
 if (isAlive())
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index b8a2b9d..310d576 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -1454,7 +1454,7 @@ public:
 {
 // Notify the broker that we're done.
 auto child = _childProcess.lock();
-auto docBroker = child ? child->_docBroker.lock() : nullptr;
+auto docBroker = child ? child->getDocumentBroker() : nullptr;
 if (docBroker)
 {
 // FIXME: No need to notify if asked to stop.
@@ -1587,7 +1587,7 @@ private:
 LOG_TRC("Prisoner message [" << getAbbreviatedMessage([0], 
data.size()) << "].");
 
 auto child = _childProcess.lock();
-auto docBroker = child ? child->_docBroker.lock() : nullptr;
+auto docBroker = child ? child->getDocumentBroker() : nullptr;
 if (docBroker)
 {
 // We should never destroy the broker, since
@@ -1598,7 +1598,7 @@ private:
 return;
 }
 
-LOG_WRN("Child " << child->_pid <<
+LOG_WRN("Child " << child->getPid() <<
 " has no DocumentBroker to handle message: [" <<
 LOOLProtocol::getAbbreviatedMessage(data) << "].");
 }
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp wsd/LOOLWSD.cpp

2017-02-09 Thread Ashod Nakashian
 wsd/DocumentBroker.hpp |1 +
 wsd/LOOLWSD.cpp|8 +++-
 2 files changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 7f19d809b16d17f669f6e15b3bf52db1c764a975
Author: Ashod Nakashian 
Date:   Fri Feb 10 01:43:32 2017 -0500

wsd: skip busy docBrokers when cleaning up

When cleaning up DocumentBrokers we hold
the global DocBrokersMutex. So we need
to keep this lock as short as possible
to serve new requests.

However when a given DocBroker is locked
and busy, or worse deadlocked, we'd end
up blocking any new client connection.

So here we skip busy DocBrokers while
cleaning up.

Change-Id: I188c9abc34fd90c4ba388894b47c1ab08d185129
Reviewed-on: https://gerrit.libreoffice.org/34119
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index a401b5a..2c0122d 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -312,6 +312,7 @@ public:
 Poco::Process::PID getPid() const { return _childProcess->getPid(); }
 
 std::unique_lock getLock() { return 
std::unique_lock(_mutex); }
+std::unique_lock getDeferredLock() { return 
std::unique_lock(_mutex, std::defer_lock); }
 
 void updateLastActivityTime();
 
diff --git a/wsd/LOOLWSD.cpp b/wsd/LOOLWSD.cpp
index 399a175..05cd665 100644
--- a/wsd/LOOLWSD.cpp
+++ b/wsd/LOOLWSD.cpp
@@ -281,7 +281,13 @@ bool cleanupDocBrokers()
 for (auto it = DocBrokers.begin(); it != DocBrokers.end(); )
 {
 auto docBroker = it->second;
-auto lock = docBroker->getLock();
+auto lock = docBroker->getDeferredLock();
+if (!lock.try_lock())
+{
+// Document busy at the moment, cleanup later.
+++it;
+continue;
+}
 
 // Remove idle documents after 1 hour.
 const bool idle = (docBroker->getIdleTimeSecs() >= 3600);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: wsd/DocumentBroker.hpp

2016-12-21 Thread Ashod Nakashian
 wsd/DocumentBroker.hpp |6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

New commits:
commit bc65f8220b7c1db3f35015927ef849aa67eba059
Author: Ashod Nakashian 
Date:   Wed Dec 21 10:09:14 2016 -0500

wsd: don't poll WS for write to check child alive

The WS could be chocked on write, but we shouldn't
assume the child is dead because of that. We are
only trying to test if the child process is alive
in that helper.

Change-Id: I108a297e43f923cab0dfa30204837dc4df15d3a1
Reviewed-on: https://gerrit.libreoffice.org/32289
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index fd3eeff..f2e7604 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -140,17 +140,15 @@ public:
 return false;
 }
 
-/// Check whether this child is alive and able to respond.
+/// Check whether this child is alive and socket not in error.
 /// Note: zombies will show as alive, and sockets have waiting
 /// time after the other end-point closes. So this isn't accurate.
 bool isAlive() const
 {
 try
 {
-using namespace Poco::Net;
 return (_pid > 1 && _ws && kill(_pid, 0) == 0 &&
-_ws->poll(Poco::Timespan(0), 
Socket::SelectMode::SELECT_WRITE) &&
-!_ws->poll(Poco::Timespan(0), 
Socket::SelectMode::SELECT_ERROR));
+!_ws->poll(Poco::Timespan(0), 
Poco::Net::Socket::SelectMode::SELECT_ERROR));
 }
 catch (const std::exception& exc)
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits