Commit graph

223 commits

Author SHA1 Message Date
Henry Castro
797e41ca56 loolwsd: fix wrong condition 2016-05-11 19:46:51 -04:00
Ashod Nakashian
2829febd15 loolwsd: logging improvements
Change-Id: I5591e309ac9fbcbd79c816b26e65f51b77018bb2
Reviewed-on: https://gerrit.libreoffice.org/24748
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-08 04:36:00 +00:00
Ashod Nakashian
8e480d7ac1 loolwsd: use paintPartTile and remove workarounds
Change-Id: Ice59004a23919c7a77a00782f7210a83bc1464e7
Reviewed-on: https://gerrit.libreoffice.org/24703
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-06 15:06:37 +00:00
Pranav Kant
27497ba4dc loolwsd: Fix tile previews for viewing sessions
Also, don't let these tile previews change part of the document
permanently. This is a temporary solution till we have some
better API from LOKit to deal with such a situation.

Change-Id: I8dfefd2b7ad8cf3e7a57afb95b57994ef0bb3b6c
2016-05-06 16:20:27 +05:30
Pranav Kant
1f990d3fc2 loolwsd: Fix incorrect position of id=, editlock= params
editlock= is always the last parameter. This fixes the slide
previews in impress documents for editing session.

Change-Id: I3531c7f52e09e655524fa0afd6fe66da504b5d70
2016-05-06 14:44:03 +05:30
Ashod Nakashian
1643938a8e loolwsd: support the tile id param when broadcasting tiles to subscribers
Obviously this is dangerous, since the id is not part of the
subscription key (the filename) so different clients could
have different ids on the same part, but in practice I
expect this not to happen. Though that clearly depends on
how clients use the id.

Change-Id: I52a0b043c9b5e5ad1111b692e4216cc9ffec5b2b
Reviewed-on: https://gerrit.libreoffice.org/24680
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 14:23:22 +00:00
Ashod Nakashian
346a063d0a loolwsd: fix regression to handling tile command
Change-Id: Idedf25f3756ea1e04daf17540b1a57e1e7af8448
Reviewed-on: https://gerrit.libreoffice.org/24679
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-05 14:22:53 +00:00
Pranav Kant
7734f2557a loolwsd: Do not allow viewing sessions to change parts
bccu#1433, bccu#1757 related.

Piggyback editlock information to tile messages so that kit can
use that information to allow changing parts only for messages
with editlock.

... and decline tile render request for tile messages without editlock
information

Change-Id: I9cedb870cd977741375665cb258d04c818481a14
2016-05-05 14:28:03 +05:30
Jan Holesovsky
191ee00f2c Run the tests on ports that do not conflict with a 'normal' loolwsd.
For the moment, it will allow running 'make check' that does not conflict with
an already running loolwsd (eg. from 'make run').  Later we can consider
running more tests in parallel.
2016-05-04 13:39:32 +02:00
Ashod Nakashian
82333e06fa loolwsd: add explanation as to why code is commented out
Change-Id: I3478d6c84cd960c4a7317ee5adc75db8c13aeaef
Reviewed-on: https://gerrit.libreoffice.org/24647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:56:41 +00:00
Ashod Nakashian
df67c4a31c loolwsd: move tilecombine handling into lokit
Change-Id: I32854769c5260444b0e97c112a141028f1cda179
Reviewed-on: https://gerrit.libreoffice.org/24641
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:36:38 +00:00
Ashod Nakashian
a240f2666f loolwsd: tile traffic is now completely centralized
WSD's DocumentBroker and Kit's Document now handle
the communication of tiles as well as all aspects
of rendering, caching, unifying requests and
distributing results etc.

Change-Id: Ie22fbaaae26b91185ee348ec7077f30430eec0f6
Reviewed-on: https://gerrit.libreoffice.org/24640
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-04 10:36:01 +00:00
Michael Meeks
6b88e97b63 Add unit test hook for libreofficekit. 2016-05-02 05:40:24 +01:00
Ashod Nakashian
67fb02d277 loolwsd: formatting, logging, and comments
Change-Id: I0292c39b18d013829d20ef23afcf970eefbe7d42
Reviewed-on: https://gerrit.libreoffice.org/24523
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:35:38 +00:00
Ashod Nakashian
ce64895cee bccu#1751 deadlock during save
While there are two separate callbacks registered
(one with lokit and the other with lokitDocument,)
there is no reason why they should be handled
separately (and indeed differently).

The lokit callback only sends notifications on
status indicator (during loading and saving)
and document password type (if protected).

Due to the different callback handlers
the status indicator was only sent to the
first client, not all (as one expects).

Furthermore, because the lokit callback
was processed on the Core thread, it
was bound to cause performance and
thread-safety issues. Specifically it
deadlocked when another callback was
in flight when a save issued status
indicator callback.

By unifying the callbacks and putting
all callback messages on the message
queue we avoid all of the above and
simplify the code.

Change-Id: I5bd790b6ce88b7939186c1ec1dead7fb6cabf7e0
Reviewed-on: https://gerrit.libreoffice.org/24522
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-30 14:34:32 +00:00
Ashod Nakashian
1dd88e68ea loolwsd: shortened some long identifiers
Change-Id: I87809f5ad2a6d8f546cf3abaf646672d2d8168dc
Reviewed-on: https://gerrit.libreoffice.org/24471
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:05:45 +00:00
Ashod Nakashian
7ff5be1f70 loolwsd: document rendering options should be set once
When loading a document first we set the rendering
options. Beyond that, the document is shared and
we shouldn't change the rendering options.

Change-Id: I0d2ac6fc43553b8395111ba2b8a3cc2796d2f0a4
Reviewed-on: https://gerrit.libreoffice.org/24470
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-29 01:04:43 +00:00
Miklos Vajna
78308db763 loolwsd: remaining 'unnecessary copy' fixes
Change-Id: I138e8473a002a15aae7752136950bb905a21fb1f
2016-04-27 14:58:33 +02:00
Henry Castro
c29944a386 loolwsd: fix close after close
The closing handshake.
Either peer can send a control frame with data containing
a specified control sequence to begin the closing handshake.

Upon receiving such a frame, the other peer sends a
Close frame in response, if it hasn't already sent one.
2016-04-18 20:27:27 -04:00
Tor Lillqvist
a08b2a0e0b Just use "/" instead of Poco::Path::separator() 2016-04-18 15:34:34 +03:00
Tor Lillqvist
3aadd910c6 We can't remove jailPath when inside the chroot as it does not exist there
When inside the chroot, what we would need to do is remove everything
below / . But doing that is a bit too risky, in case some developer
screws up some detail and that code happens to run outside the chroot
after all, and the developer's machine gets trashed. So just remove
paths we can reasonably assume won't exist as global pathnames on a
developer machine: loSubPath and JAILED_DOCUMENT_ROOT.

Currently the actual complete cleanup of loolkit jails happens in
loolwsd when it is exiting. That is a bug and will have to be
fixed. It should be done in loolforkit as soon as possible after the
loolkit process has exited.
2016-04-18 13:18:39 +03:00
Ashod Nakashian
a70c5300b1 loolwsd: childConnected event added to UnitWSD
Change-Id: I3d19465229b434d07f50290f08462e9c9c66a6ca
Reviewed-on: https://gerrit.libreoffice.org/24160
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-17 15:26:09 +00:00
Michael Meeks
6388298a04 Attempt at a --nocaps argument to run with no caps, ie. under valgrind. 2016-04-16 20:47:55 +01:00
Michael Meeks
ebfa339da0 Cleanup symlinking and add realpath symlink if necessary. 2016-04-15 16:17:04 +01:00
Michael Meeks
7376b7475e Font bits: create symlink in jail at OS instdir path, to point at /lo
This ensures that bundled fonts in instdir/share end up resolved to
the same path that they were in when the forkit font config was setup.

It may also help locate other pre-inited resources.

Also copy in ~/.fonts in debug mode - can't hurt.
2016-04-15 14:35:57 +01:00
Ashod Nakashian
7df929cb77 loolwsd: use SocketProcessor in kit
SocketProcessor doesn't need to take response
instance, since by the time it is called we
are already upgraded to WebSocket and it's
too late to set a request-level status.

Change-Id: Id95087e60354a50148c88427130613356679cf82
Reviewed-on: https://gerrit.libreoffice.org/24110
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-15 11:54:30 +00:00
Tor Lillqvist
c9796255ae Don't check for undocumented "eof" frames read from a websocket either
Now with "disconnect" frames gone, surely checks for "eof" ones can go
away too, whatever they were.
2016-04-13 15:50:09 +03:00
Tor Lillqvist
e5de11113b Don't check for or send "disconnect" frames anywhere and don't document them
Follow-up to 68b3a2c81e.
2016-04-13 15:49:10 +03:00
Ashod Nakashian
65ee0a1cdd loolwsd: corrected etc file copying
Change-Id: Ie920bbdee38d4b0a338753a6d483e274052939ce
Reviewed-on: https://gerrit.libreoffice.org/24053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-13 11:49:31 +00:00
Tor Lillqvist
0f3d98d2d1 Try to use consistent indentation for parameters to SocketProcessors()
But yeah, not sure why the blocks of the lambdas are de-indented like that.
2016-04-13 12:22:19 +03:00
Tor Lillqvist
c8a46e78a8 bccu#1678: Check whether document can be discarded also in stop predicate
Seems to fix the problem that the loolkit processes hang around
forever even if there is no associated client.
2016-04-13 12:17:59 +03:00
Michael Meeks
25a092d7de Add memory accounting metric to UnitPrefork.
Also add hooks to allow custom LOK <-> WSD message for this test.
2016-04-12 21:58:27 +01:00
Tor Lillqvist
8dcd7d22e4 Remove a few more more leftovers from the "broker" terminology 2016-04-12 14:24:47 +03:00
Ashod Nakashian
4cab42b20f loolwsd: logging improvements
Change-Id: Idba11b0ae18337d78ea504a455ddc9494cff7ef0
Reviewed-on: https://gerrit.libreoffice.org/23967
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:21:32 +00:00
Ashod Nakashian
2a65f2e397 loolwsd: invoking disconnect on the session from Connection deadlocks
Connection thread should not attempt to disconnect the session,
which in turn will try to unload the document, which will
wait on the connection to destroy. The latter will never
happen since the connection destructor must, correctly,
wait for its thread to finish, which is waiting on itself now.

Since the session disconnect is already called from the session
destructor, there is no need to explicitly invoke it here.

Change-Id: Iaf9e8a10d4caa9001208084e909a14b4d4c5105e
Reviewed-on: https://gerrit.libreoffice.org/23966
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-10 17:19:55 +00:00
Michael Meeks
5b8f49423d More kit unit testing tentacles. 2016-04-09 18:29:20 +01:00
Tor Lillqvist
d0309d9a83 No reason to use unsigned instead of bool 2016-04-08 17:17:13 +03:00
Tor Lillqvist
40914ca336 Initialise the Connection::_joined in the constructor
This seems to get rid of the "terminate called after throwing an
instance of 'Poco::SystemException'" problem for me at least.

Sigh. Why can't the compiler warn about such things? I build with
clang++ -Wall -Wextra. The Connection class is fully defined inside
the LOOLKit.cpp so it should be able to, right?
2016-04-08 17:16:28 +03:00
Tor Lillqvist
4129b7b84e Don't use strsignal(), use Util::signalName()
Presumably it is only developers that are interested in signals, and
terms like SEGV or ABRT are more precise than their textual
descriptions like "Segmentation violation" or "Aborted".
2016-04-08 15:31:47 +03:00
Tor Lillqvist
f7612b989a Give a potential handleFatalSignal() time do its job
Sleep a second before exiting in case we get a fatal signal just when
about to finish, which sadly seems to happen often. (In fact, if
handleFatalSignal() is running at the same time, it will kill the
process so we never get to the _Exit() call.)
2016-04-08 15:22:52 +03:00
Tor Lillqvist
481afd0306 Exit bluntly in all cases from a loolkit process 2016-04-08 11:48:02 +03:00
Tor Lillqvist
c71d12ae63 Process name and id are already part of each logging output line 2016-04-07 20:22:57 +03:00
Tor Lillqvist
584a805781 The SocketProcessor() 'name' parameter can now be dropped 2016-04-07 20:07:50 +03:00
Tor Lillqvist
d36c8bbbba Avoid some use-once variables
Also, use different names for the HTTPRequestHandler threads in
ClientRequestHandlerFactory and PrisonerRequestHandlerFactory.
2016-04-07 19:31:56 +03:00
Tor Lillqvist
9acc0b052e Bin one more redundant thread name in debug log 2016-04-07 19:26:01 +03:00
Tor Lillqvist
4fdd6d684f Reduce redundant information in logging
The logging functions already display the thread name on all output
lines. No need to mention it another time in the thread start and
finish logging messages.
2016-04-07 15:53:53 +03:00
Tor Lillqvist
acc59a2ea5 Make error messages more consistent and use Log::syserror() in more places
A call to Log::error() should be enough to indicate that it is an
error. We don't need to prefix the message with the string "Error: "
in some cases but not others. (If we do want such a prefix for all
errors, surely then we should add it in the actual Log::error()
function.)

Also, change some more Log::error() calls to Log::syserror() where
appropriate.
2016-04-07 11:53:44 +03:00
Tor Lillqvist
5637064e9a Factor out the prctl() calls
Silly to keep copy-pasting the same couple of lines over and over
again.
2016-04-07 11:53:33 +03:00
Tor Lillqvist
6229648610 Include dlerror() message in log output also if dlsym() fails 2016-04-07 10:13:56 +03:00
Ashod Nakashian
6e5e9033f2 loolwsd: removed Admin pipe
Admin no longer needs a pipe as it's notified
from WSD. It is now a singleton with improved
locking.

The tracking of documents and views still needs
improvement and corrections.

Change-Id: If614331de6dd595c6dd4443f480d4ab588ca4551
Reviewed-on: https://gerrit.libreoffice.org/23860
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-06 13:52:57 +00:00