Commit graph

215 commits

Author SHA1 Message Date
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
Michael Meeks
6ec2e8ca68 Rename loolbroker to loolforkit - and split the child to LOOLKit.
Move ChildProcessSession to shared_source and fix the static
ClientPortNumber issue.
2016-04-05 14:45:46 +01:00
Tor Lillqvist
8e7196ffa0 Insert LOOLKit.cpp contents into LOOLBroker.cpp
As we don't build a separate loolkit program any more we don't need
LOOLKit.cpp.
2016-04-04 09:23:38 +03:00
Tor Lillqvist
a132e06409 Bin the non-preinit and non-fork code paths
Preiniting LibreOfficeKit and forking kit processes (instead of
spawning) has worked fine for a while, and has been the default way
this works.

No 'loolkit' program gets built any more.
2016-04-04 09:07:59 +03:00
Ashod Nakashian
fdd3efaad8 loolwsd: reduced some excessive logs to trace level
Change-Id: I9ffcdf5c3ad5781db93e0e3dd7aa7b137c77b25a
Reviewed-on: https://gerrit.libreoffice.org/23792
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:09:19 +00:00
Ashod Nakashian
ed1790d7a3 loolwsd: kit destruction improvements
Change-Id: Ia491e5dc85e13eda12bb47690a8d335ad0917468
Reviewed-on: https://gerrit.libreoffice.org/23791
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:53 +00:00
Ashod Nakashian
c118987dc6 loolwsd: Removed Broker <-> Kit pipes
Broker is now just a simple spawn-machine.
It only gets requests from WSD to spawn
new kit instances, which it doesn't even
track.

Once a kit instance is initialized, it
connects to WSD with a control WS.
From there on, it's up to WSD to manage
the kit process.

Also was removed the benchmark logic
since it can no longer function.

Change-Id: I1bf56bc6416c9eadafba637276bbb8b3107e5727
Reviewed-on: https://gerrit.libreoffice.org/23790
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:35 +00:00
Ashod Nakashian
d5e2f64790 loolwsd: WSD <-> Child direct communication
WSD now communicates on a WebSocket directly
with kit processes. ChildProcess encapsulates
kit processes and the control WS, which itself
is owned by DocumentBroker.

Change-Id: Ica209aaa07974739b8e51a14e11325d084e193f6
Reviewed-on: https://gerrit.libreoffice.org/23789
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:08:01 +00:00
Ashod Nakashian
4be24759f3 loolwsd: SocketProcessor takes HTTPResponse and not HTTPServerResponse
Change-Id: I8a6e1468bc26b4a81ae13a567fd7331207ac37fc
Reviewed-on: https://gerrit.libreoffice.org/23786
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:06:42 +00:00