loleaflet/src/core/Socket.js   |    3 +++
 loleaflet/src/errormessages.js |    1 +
 wsd/DocumentBroker.cpp         |   15 +++++++--------
 3 files changed, 11 insertions(+), 8 deletions(-)

New commits:
commit 8809f4f10459ac0258a43a22408a2e5b41b7d9d9
Author:     Ashod Nakashian <[email protected]>
AuthorDate: Wed Oct 2 08:38:45 2019 -0400
Commit:     Michael Meeks <[email protected]>
CommitDate: Mon Oct 28 10:48:37 2019 +0100

    wsd: notify the client of document load timeout
    
    This gives users some feedback as to why loading
    failed, which in this case is quite useful (as
    it is highly unlikely retrying will help, since
    the issue is with the document, being too large
    or resource intensive).
    
    Reviewed-on: https://gerrit.libreoffice.org/80325
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>
    (cherry picked from commit d332e1d4a2999da4f93e7831ffc0d58e96fad1c6)
    
    Change-Id: I01052105b8412023ac7651f3a92cc67fe739fd1a
    Reviewed-on: https://gerrit.libreoffice.org/81563
    Reviewed-by: Michael Meeks <[email protected]>
    Tested-by: Michael Meeks <[email protected]>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 94454b82d..6f3d22d27 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -590,6 +590,9 @@ L.Socket = L.Class.extend({
                        } else if (errorKind.startsWith('faileddocloading')) {
                                this._map._fatal = true;
                                this._map.fire('error', {msg: 
errorMessages.faileddocloading});
+                       } else if (errorKind.startsWith('docloadtimeout')) {
+                               this._map._fatal = true;
+                               this._map.fire('error', {msg: 
errorMessages.docloadtimeout});
                        } else if (errorKind.startsWith('docunloading')) {
                                // The document is unloading. Have to wait a 
bit.
                                this._map._active = false;
diff --git a/loleaflet/src/errormessages.js b/loleaflet/src/errormessages.js
index 16dc14086..37addbc20 100644
--- a/loleaflet/src/errormessages.js
+++ b/loleaflet/src/errormessages.js
@@ -23,6 +23,7 @@ errorMessages.sessionexpired = _('Your session has been 
expired. Further changes
 errorMessages.faileddocloading = _('Failed to load the document. Please ensure 
the file type is supported and not corrupted, and try again.');
 errorMessages.invalidLink = _('Invalid link: \'%url\'');
 errorMessages.leaving = _('You are leaving the editor, are you sure you want 
to visit %url?');
+errorMessages.docloadtimeout = _('Failed to load the document. This document 
is either malformed or is taking more resources than allowed. Please contact 
the administrator.');
 
 if (window.ThisIsAMobileApp) {
        errorMessages.storage = {
diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index 791089042..c3f0dd04c 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -292,22 +292,21 @@ void DocumentBroker::pollThread()
 #if !MOBILEAPP
         if (!_isLoaded && (limit_load_secs > 0) && (now > loadDeadline))
         {
+            LOG_WRN("Doc [" << _docKey << "] is taking too long to load. Will 
kill process ["
+                            << _childProcess->getPid() << "]. 
per_document.limit_load_secs set to "
+                            << limit_load_secs << " secs.");
+            broadcastMessage("error: cmd=load kind=docloadtimeout");
+
             // Brutal but effective.
             if (_childProcess)
-            {
-                LOG_WRN("Doc [" << _docKey << "] is taking too long to load. 
Will kill process ["
-                                << _childProcess->getPid()
-                                << "]. per_document.limit_load_secs set to " 
<< limit_load_secs
-                                << " secs.");
                 _childProcess->terminate();
-            }
 
             stop("Load timed out");
             continue;
         }
 
         if (std::chrono::duration_cast<std::chrono::milliseconds>
-                    (now - lastBWUpdateTime).count() >= 5 * 1000)
+                    (now - lastBWUpdateTime).count() >= COMMAND_TIMEOUT_MS)
         {
             lastBWUpdateTime = now;
             uint64_t sent, recv;
@@ -317,9 +316,9 @@ void DocumentBroker::pollThread()
                                        // connection drop transiently reduces 
this.
                                        (sent > adminSent ? (sent - adminSent): 
uint64_t(0)),
                                        (recv > adminRecv ? (recv - adminRecv): 
uint64_t(0)));
-            LOG_DBG("Doc [" << _docKey << "] added sent: " << sent << " recv: 
" << recv << " bytes to totals");
             adminSent = sent;
             adminRecv = recv;
+            LOG_TRC("Doc [" << _docKey << "] added stats sent: " << sent << ", 
recv: " << recv << " bytes to totals.");
         }
 #endif
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to