Commit graph

2227 commits

Author SHA1 Message Date
Miklos Vajna
343e9c468d loolwsd: fix -Werror,-Wsometimes-uninitialized 2016-04-05 14:33:40 +02:00
Henry Castro
5657eac618 loolwsd: remove duplicate exit 2016-04-05 08:29:28 -04:00
Michael Meeks
d498bff3f0 Plural of child is children. 2016-04-05 12:23:02 +01:00
Michael Meeks
0278743fb2 Move pre-forking of children from loolbroker to WSD. 2016-04-05 12:21:04 +01:00
Ashod Nakashian
36a3810541 loolwsd: fixed convert-to and re-enabled test
Change-Id: I91ad9ac7dbe394d4a560081379e35442f1469eb8
Reviewed-on: https://gerrit.libreoffice.org/23825
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 03:01:06 +00:00
Ashod Nakashian
4bc26f25d5 loolwsd: wait for new child instances if none is available
Change-Id: If7de4ae73e9432694a0cf032b19d7e0ab9c5a9d1
Reviewed-on: https://gerrit.libreoffice.org/23824
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 03:00:21 +00:00
Ashod Nakashian
c2e0812a8c loolwsd: no need to destroy, just exit
Change-Id: I12332678d81b9c0880271f980935b655a1dece08
Reviewed-on: https://gerrit.libreoffice.org/23823
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:59:48 +00:00
Ashod Nakashian
3499878fae loolwsd: logging and cleanups
Change-Id: I0664be51da54d2e374808256e6598ba025f0324e
Reviewed-on: https://gerrit.libreoffice.org/23822
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:59:12 +00:00
Ashod Nakashian
94c3033408 loolwsd: wait for the Connection thread to exit before destroying
Also, the thread is joinable only once.

Change-Id: Ia0d8e4c350a6bedcf15873c751fffa837460e4bf
Reviewed-on: https://gerrit.libreoffice.org/23821
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-05 02:58:17 +00:00
Henry Castro
2c18eb8495 loolwsd: remove unnecessary response frame
The response was to verify that the command message
was successfully executed, but it can be replace by log messages.
2016-04-04 16:29:27 -04:00
Pranav Kant
dc28273dcf Fixed a regression in opening password protected docs
Change-Id: Ife378538c98f091e271e0c474fb271c513887774
2016-04-05 00:15:30 +05:30
Tor Lillqvist
321b244eb3 Catch also NetException in SocketProcessor()
Doesn't seem to fix anything, but probably is a good idea to not let
such an exception propagate, but treat it as the connection closing.
2016-04-04 15:46:27 +03:00
Tor Lillqvist
bbb4355e73 Output also a trace in DocumentCallback 2016-04-04 14:20:20 +03:00
Tor Lillqvist
b622b5ea2e Use 'using' consistenly 2016-04-04 13:29:02 +03:00
Tor Lillqvist
2732d756be LibreOfficeKit is not a process
We call the process "loolkit". LibreOfficeKit is an API, and a 'class'
in that API.
2016-04-04 12:12:14 +03:00
Tor Lillqvist
7cb5baedfc Try libmerged first
In the instdir/program of an --enable-mergelibs build of LibreOffice
there is also a dummy libsofficeapp.so. Obviously we don't want to
even try that. So look for libmergedlo.so first.
2016-04-04 12:05:55 +03:00
Tor Lillqvist
383eb5c666 Don't ask broker to fork a non-positive number of children
I easily got the thing into a state where it kept forking new
processes without limit even if no client was doing anything. The log
output contained lines like:

wsd-09526-04 00:00:48.302029 [client_ws_001b ] MasterToBroker: spawn -1

brk-09528-00 00:00:48.279945 [loolbroker     ] Broker command: [spawn -1].

brk-09528-00 00:00:48.279964 [loolbroker     ] Spawning -1 childs per request.
brk-09528-00 00:00:48.279974 [loolbroker     ] Creating -1 new child.

This fixes that, but there are still several issues remaining.
2016-04-04 11:11:53 +03:00
Tor Lillqvist
9a456770f1 Why 'signed' when 'int' is much simpler? 2016-04-04 10:57:49 +03:00
Tor Lillqvist
194b662b54 Don't truncate response in logging
There is no \r there any more, just a \n.
2016-04-04 10:36:34 +03:00
Tor Lillqvist
f7c213c87e Bin leftover from benchmark code
It died in c118987dc6.
2016-04-04 10:32:56 +03:00
Tor Lillqvist
d262f43b93 ClientPortNumber here can never differ from DEFAULT_CLIENT_PORT_NUMBER
So just use DEFAULT_CLIENT_PORT_NUMBER and don't confusingly include
ChildProcessSession.hpp in the test program sources just to define a
static (file-local) ClientPortNumber variable that never gets set to
anything except its initialized value. ChildProcessSession is specific
to the internals of loolwsd and loolbroker and should not be used in
the test programs.
2016-04-04 10:13:16 +03:00
Tor Lillqvist
d137653db5 Avoid over-engineering: Insert Capabilities.hpp in the only file where used 2016-04-04 10:05:30 +03:00
Miklos Vajna
802c702221 loolwsd: fix -Werror,-Wshadow 2016-04-04 09:02:05 +02:00
Tor Lillqvist
9ec0ae58a4 These can be static 2016-04-04 09:45:21 +03:00
Tor Lillqvist
957788a6e1 Define FIFO_ADMIN_NOTIFY in only one place 2016-04-04 09:43:29 +03:00
Tor Lillqvist
01be515760 Include only what you use 2016-04-04 09:36:27 +03:00
Tor Lillqvist
b6419ee915 Include only what you use 2016-04-04 09:31:52 +03:00
Tor Lillqvist
c2370c56ef Use 'using' consistenly 2016-04-04 09:31:03 +03: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
208612bc10 loolwsd: temporarily disabled convert-to test
Convert-to is broken after re-designing Broker
and simplifying it. Temporarily disabling it
to help `make check` pass until it gets fixed.

Change-Id: Id49f86d8a1a25367233a09b865630ed3a210a4fd
Reviewed-on: https://gerrit.libreoffice.org/23793
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:09:36 +00: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
f4b80e630a loolwsd: consume new child from wsd
And spawn new child instances.

Change-Id: I51886f4645a1c8944ccde2e0fae415afc7c8fc24
Reviewed-on: https://gerrit.libreoffice.org/23788
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:07:27 +00:00
Ashod Nakashian
25a68bf7e9 loolwsd: support for child control WS
Change-Id: Id82009a6d5a20eeff9a7b5c628ec719845e7769e
Reviewed-on: https://gerrit.libreoffice.org/23787
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:07:10 +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
Ashod Nakashian
653da3a409 loolwsd: Document::onLoad is now exception safe
In face of exceptions, the lock was not released
and the condition variable was not signalled,
thereby causing all subsequent views on the
same document to fail loading.

Change-Id: I18d3cefcc74a158facefe1e74a9c802ee048b014
Reviewed-on: https://gerrit.libreoffice.org/23785
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:06:24 +00:00
Ashod Nakashian
ae8ce06162 loolwsd: removed unnecessary from pipe messages
Change-Id: I5fc310f98764b31fc50f877c28d6076bbb14866f
Reviewed-on: https://gerrit.libreoffice.org/23784
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:46 +00:00
Ashod Nakashian
aacd162673 loolwsd: FIFO_NOTIFY -> FIFO_ADMIN_NOTIFY
Change-Id: Ia42983010b3962ca9228032817c6f9024a74c59f
Reviewed-on: https://gerrit.libreoffice.org/23783
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:31 +00:00
Ashod Nakashian
bcf6ab75b8 loolwsd: statics are PascalCased and other cleanups
Change-Id: I1c7c62eb812d2e727b7256152c0c774350d24b52
Reviewed-on: https://gerrit.libreoffice.org/23782
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:05:10 +00:00
Ashod Nakashian
8a318c879a loolwsd: merged child command dispatching into a single class and renamed
Change-Id: I894849ea7a6c69c084e922c76468c5e9eb621406
Reviewed-on: https://gerrit.libreoffice.org/23781
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:55 +00:00
Ashod Nakashian
504ffec648 loolwsd: request new child from Broker for convert-to requests
Change-Id: I29ff2a416c04393a2b2875e9ffff429f4e25e4c5
Reviewed-on: https://gerrit.libreoffice.org/23780
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:36 +00:00
Ashod Nakashian
21cdf9d503 loolwsd: removed unused authentication function for now
Change-Id: I8c57adecab03eb186aeacea365f092a71e2e097d
Reviewed-on: https://gerrit.libreoffice.org/23779
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:04:18 +00:00
Michael Meeks
0a42ab7b81 Remove bogus 10 second sleep.
Change-Id: If44f28fdca37997eca09679bb9865944909ef4f2
Reviewed-on: https://gerrit.libreoffice.org/23778
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:58 +00:00
Michael Meeks
1b25179b25 Use bind mounting to accelerate jail creation.
of the 10k files still linked into the jail; 5700 are from usr/
so bind mount just that directory, also set noatime, ro, and
some other helpful looking options.

Change-Id: I28d2d5cbbdf33fb57ea0f0c0915cb267603ee16d
Reviewed-on: https://gerrit.libreoffice.org/23777
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:37 +00:00
Ashod Nakashian
285026b6f6 loolwsd: removed PipeRunnable thread from Broker and merged it with main
Change-Id: Ie10f046ed230d891eb0647e409756a34a4b146b8
Reviewed-on: https://gerrit.libreoffice.org/23776
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:21 +00:00
Ashod Nakashian
ba7db55353 loolwsd: cosmetics
Change-Id: I6c0c2e088e1e428d45cc56a31e7c1f3b8966dc2b
Reviewed-on: https://gerrit.libreoffice.org/23775
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:03:07 +00:00
Ashod Nakashian
265210741e loolwsd: removed unused read pipe from ChildProcess
Change-Id: I8307488227bf65a6f6fdd829728cd74722a24f58
Reviewed-on: https://gerrit.libreoffice.org/23774
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-04-04 04:02:51 +00:00