The last-editing-session could still be valid, but
waiting disconnection, in which case the kit might
have already discarded it, and so saving would
fail (silently, and thereby leaving docbroker
waiting for the save response).
To avoid this, we always validate the
last-editing-session before using, and not just
when setting it.
Change-Id: I60cd219d8e5a9945396110c8f8d194e87f81afba
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit e1fc6adbfef7ee0678c7a563fd6142c32f2da4a6)
This log entry can be misleading on its own.
When shutting down, the modified flag is not reset,
and that in itself is not a cause for concern.
So this log entry is seen much more often than we
expect. If we truely fail to save/upload, there
will be other errors that will be the tell-tale
signs of a serious issue. So it's reasonable to
downgrade this error to a warning (and watch for
other errors).
Change-Id: Ic879c3fbac887ed5b64bdd1a31aa38bcfd863850
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 7db86b3eb2cdc2a44023e7b7491e1ee202146ef5)
Unloading duration depends on the time to save
and upload the document, during which a new view
might be opened. We now allow aborting the unloading
and resume reusing the document as-is.
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 8f299eb2cdfe0ef869a8c90fbc602a93ba2fcb73)
Change-Id: I7bc485177929c0d1c9ef12b02672db493ac402c9
This way it will reload the document without getting
additional errors like "this is embaressing.."
and not timed out on large files due to retrying for a limited
time.
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ied341200ca21e1b7243daaf62813bc9ed69fecd3
This adds a new service render-search-result, which renders an
image of the position where, the search fund a hit. The search
result contains the information in which object or paragraph,
which is just the node id and node type from the document model.
The service takes the document and the search result (xml file)
as the input and returns a PNG image as the output.
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
Change-Id: Iffc158c5b0a3c9a63f8d05830314c9bc1616b3b1
Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>
When async save was started but we want to stop DocumentBroker
- we shouldn't kill the socket which listens to save result.
Because when we kill socket we will destroy DocumentBroker
before saving is completed, this allows for a minimal time
to connect again to the document and receive old content
from the WOPI storage. When we wait for async save result
we will keep DocumentBroker alive and next session can be
connected and receive correct content.
fixes: https://github.com/CollaboraOnline/online/issues/2747
Signed-off-by: Szymon Kłos <szymon.klos@collabora.com>
Change-Id: I5505a5ccc1f3d6928c723bddfea16bf5c5798d1e
Also clear its input buffer explicitly.
Change-Id: I8badbb96d98eaf10433a65fcfd13b0d6d5893594
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Ignore input in a somewhat gentler way.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I758302dc3bb1aa87f9fbfa726f73f4b9339e08c2
If the last upload had failed and we are closing,
make sure to save a new copy (i.e. save even if
unmodified) so we would have the latest version to upload.
Change-Id: I25efb76eaf9c0e05a2d18071b273447803b17cc5
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This prevents auto-saving while a
save is in progress.
Change-Id: I2606df704482ad54a954414d48ed3ca35d4764a9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
There is an important distinction between
internally saving a document and uploading
the latest saved version to storage.
Core reports the modified state, which was
at some point used to flag the modified state
in the admin console. This state is misleading
if uploading failed.
This patch makes this distinction even more
explicit than it was. We now always update
the modified flag given by Core, and flag
the document as modified in the admin console
too. But we only update the admin console to
unmodfied when we successfully upload and the
document is not modified at that point (which
it might very well be modified again by the
time we finish uploading).
Without this patch, we stop updating the
modified flag when uploading fails. This
is problematic when said failure occures
right before closing the document, because
the document will have no modification
but we will be stuck thinking it is modified.
This combines two commits:
8c602e179e
and
9db39ce741
Change-Id: I31c72aa2491b8e98597075cd35b6a809fab560a1
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
We ask for save as for the plain/text type documents
such as csv or txt. Notify other views about it so
they can follow one to the new document
Signed-off-by: merttumer <mert.tumer@collabora.com>
Change-Id: I4cdcec6148d1064ad4e90ad9be2ce483c19a8eda
Write to the Trace Event JSON file in just one place, protected by a
mutex.
Handle metadata events separately. We want them to propagate to the
output if Event Trace generation is just enabled, regardless whether
it has been turned on or not.
We can send the metadata for the Kit process only after we have opened
the docuemnt as sending a Trace Event to WSD uses the (singleton)
Document object in Kit.
Introduce some new functions for the above and adapt callers
appropriately.
Generate a Complete event for the handling of one image tile, from
setting the src attribute of the Image object to finishing the onload
function.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5978e0fb2495e0d2dc479bf861eb4ac7da03fa50
In MobileApp builds, the 'else if' was evidentally
getting chained to the unrelated if/else clauses
before the '#if !MOBILEAPP' at line 434 of
DocumentBroker.cpp.
Now this 'else if' is a standalone conditional
in MobileApp builds and it's part of the
'remove idle documents' conditional chail otherwise.
While fixing that, the missing indentation
of a for-loop under a conditaional is also
fixed, to avoid confusing maintainers.
Change-Id: If3de18f385d84cb22d757cf73743fd8541c36df9
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Templates are special because the file that gets
loaded is not in the same format as the final one.
An implicit save-as is issued in Kit for template
loads right after loading to create the final
document format. It is this file (as opposed to the
template) that needs to be uploaded, which we do
right after we get the 'status:' message in
DocBroker to actually create the first version
in storage.
Change-Id: I23cbf527f1059b0b4059f15069737ab35ac860e7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
To avoid writing (saving) while reading (uploading) or
any other undesirable racse on the document file,
we atomically rename the file after saving on disk
to pass ownership.
After saving in Core, we rename the document in the
jail to .upload (by appending it). DocumentBroker
looks for the file with that extension and atomically
renames it to .uploading (by appening the 'ing' suffix).
This way, the Kit only renames from the original to
.upload and DocBroker renames only .upload to .uploading.
This guarantees that we never rename the same file
concurrently.
Uploading decision is strictly based on the modified
timestamp of the .uploading file, compared to the
timestamp of the last file we uploaded successfully.
Change-Id: I03520cd8c87605f6dad417e7a978204f76fc0c38
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This makes sure that if the document isn't modified, we
will detect no change from the storage as well and
avoid making an unnecessary upload.
Change-Id: I8ba2850921d75c96b2aa4f6deb86891b4fad0ea0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The client always issued a save before renameFile.
This worked fine until we make uploading asynchronous.
Now that uploading is done asychronously, the renameFile
command arrives while uploading is still in progress
and fails because renaming is done via the same
storage API used for uploading.
It is best to do both the saving (including uploading)
and renaming directly in WSD, instead of relying on
the client to save explicitly before renaming.
Change-Id: I99f6294f4c83130bc13ec8e3b013ba0192f0f84c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
With async uploading we have to process the
stop-condition only after we get the response from
the async operation. For now, we don't stop
if we fail to upload, giving a chance to retrying.
Timeout should be used in the poll loop to
limit how long we retry.
Change-Id: I8e8f8618f92f34ef2f1853e499f4f8d6ce932b40
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is to also include the 'force' case that is
needed when unloading a document.
Now that the force flag is reliably set, we don't
need to override it in needToUploadToStorage.
Change-Id: Ic0672e6c7bcb53a17ec6a0cbd2d2f8b434fbc300
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Now we can handle the response of the storage
after the async upload is complete (or timed out).
Change-Id: I29d450646bddb07f02bb17d257e7e0fa372ce357
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Add the necessary support for handling async
document upload to storage in DocumentBroker.
Change-Id: Id7a58c245d729cef58669bafb60db450f7ebbba2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
The path to the local file is relative to the jail.
Change-Id: Ie008aee4afc264339706b5b4715af35cd71ac55d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Also avoid generating abbreviations in various message handling loops
unless debugging is enabled.
Change-Id: I22f4929b0bfd4da36917db6882bb2f5f5be02780
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
It is (for now) produced (by the ProfileZone things in core) whenever
logging level is "trace". The Event Trace file pathname can be given
in the loolesd.xml file or on the loolwsd command line.
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6d5829121e71460a4600ee94d2ebf51043c8893f
When loading hasn't completed yet, DocBroker can't
simply send a message to Kit that the session is
disconnected, because there would be no UI or
handlers for events if that were the only session.
Of course letting the document load, only to close
it, is also less than helpful to resource consumption.
Here, we recognize this case and simply terminate the
loading by killing the Kit process altogether to
avoid any potential hangs or resource wastage.
Change-Id: Ia72de715cc6238831c244444bb47b417b9b1e1a4
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Add a new state before load the document,
when Macro Security dialog popup, and avoid
to send the event load timeout.
Change-Id: I5973c5205e90e5447e5478cbab895709a68606f6
Signed-off-by: Henry Castro <hcastro@collabora.com>