Commit graph

56 commits

Author SHA1 Message Date
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Tor Lillqvist
4ab070ec38 Sort #include and using lines for consistency
... but did not have the time or energy to do it in all files.

Change-Id: I92ea101cae1ad7be0fd2f31ce5a8d4b4149332c9
2017-11-08 10:34:37 +02:00
Miklos Vajna
7ab856b196 common, wsd: clean up redundant casts
Change-Id: Iad7e2417c6b1a154f6ad21839b841ca452e835c5
2017-10-24 09:23:54 +02:00
Marco Cecchetti
ee6e64528d wsd: support for FSIZE and NOFILE system limits
The routine for handling the configuration for the max file size
limit, was wrongly using NOFILE. Now we handle both limits correctly.

Change-Id: Ie8b63617286f66af6d4eb1b35b9e4f4b28f3c2a6
Reviewed-on: https://gerrit.libreoffice.org/42803
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/42811
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-09-26 17:40:31 +02:00
Pranav Kant
29db4b447f admin protocol: 'total_mem' -> 'mem_consumed'
total_mem can be confused with total system memory or total memory
availabe to loolwsd process. Change the API to say what it actually
returns.

Change-Id: I55c246b8a1d0c5c52767520150e55616266a6d4f
2017-08-29 12:12:13 +05:30
Pranav Kant
65e3f7c7df admin: expose total available memory to admin clients
Take into reckoning the memproportion config value for total available
memory to us.

Change-Id: Ib93c88d746268f3e9f566beed7df77357d530eba
2017-08-29 12:12:08 +05:30
Pranav Kant
a9522f38aa wsd: Notify forkit conditionally about rlimits
No need to notify the forkit very early when loolwsd is initializing and
forkit pipes are not set. Forkit is notified of rlimits anyway
explicitly in the URL when it is initialized; no need to try to
initialize it again.

Change-Id: I9fde13e42f6e6393da7cf245ed979538d715319a
2017-08-21 20:06:11 +05:30
Pranav Kant
b0ad8874dc wsd: don't write until forkit write pipe is ready
Change-Id: I95439e8e77dc308d993b07ccbd273228f755ce14
2017-08-21 20:06:06 +05:30
Pranav Kant
160c1f555a Save unsaved documents when memory consumption is high
These saved documents are then removed to free some memory when next
memory cleanup is triggered in the admin loop.

Change-Id: Ia789a65dc204b546f1d3627a8006c4590bdca371
2017-07-11 17:51:47 +05:30
Pranav Kant
ccce64eeef This is percentage of total sys memory, not total consumed memory
Change-Id: I16b8b3d217cd0fabed83a9c63a5966cc6fe4d8fb
2017-07-11 17:51:47 +05:30
Pranav Kant
aa6b96aaed Skip memory cleanup when memproportion is not configured
Change-Id: I3799d914b5155c37f37bb497ac48e76c1a68761b
2017-07-10 20:41:49 +05:30
Pranav Kant
5ef7606316 Update the iterator too
Change-Id: Ia715fa11eb21a25935a2075d09c674bd45472e96
2017-07-08 01:52:46 +05:30
Pranav Kant
fde57adbbf Introduce hard mode when we are OOM
Start killing documents when memory usage goes above threshold.

Also make it possible to close documents from admin instance.
In DocumentBroker::closeDocument, just set the _stop flag and wake
up the polling thread which will terminate the children, instead of
manually terminating the children.

Change-Id: Ie70e05b3fb6ea816a87b6dcfaed92cdddb94aa90
2017-07-07 21:14:53 +05:30
Aditya Dewan
bc7fa9a812 admin: convert document list to drop down
Change-Id: I23635599b008fb0bfa694b4e73cb8f18f49c8ab7
Reviewed-on: https://gerrit.libreoffice.org/39170
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-07-06 09:18:09 +02:00
Aditya Dewan
681138ab54 tdf#106451 admin: graph to monitor network activity
Change-Id: Id71ef4e2a9d16e72f4df442fbf646a39213b61d5
Reviewed-on: https://gerrit.libreoffice.org/38621
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-06-16 09:55:01 +02:00
Ashod Nakashian
44d8876f27 Remove data rlimit
Seems to have no effect, so gone in
favor of RLIMIT_AS (virtual memeory).

Change-Id: I210879ec9285f420c9f9839cdabf45c42d865fb3
Reviewed-on: https://gerrit.libreoffice.org/38720
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-13 06:27:12 +02:00
Ashod Nakashian
459249b177 wsd: apply rlimits set from Admin Console to ForKit
Change-Id: I425c28ce08c5ecd659c4fe8eaa1a7ed3634e7f18
Reviewed-on: https://gerrit.libreoffice.org/38678
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:20:13 +02:00
Ashod Nakashian
9e11cd7db7 Support setting rlimits from Admin Console
Change-Id: Ia0d45948998d7a5612a1828a90ad20908d07639e
Reviewed-on: https://gerrit.libreoffice.org/38677
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:19:53 +02:00
Aditya Dewan
9502741590 tdf#107278 admin console: adding graph to track CPU load
Change-Id: Idb07fe4139dd639a49ce1545cc15895f74876b06
Reviewed-on: https://gerrit.libreoffice.org/38425
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-06-08 12:58:12 +02:00
Michael Meeks
eeaf436d53 Admin: show cumulative bandwidth sent / recv'd over all time.
Change-Id: I3f9f398d1de19d54e0aa4c51bc44c597019dc839
2017-06-03 22:53:57 +01:00
Aditya Dewan
9db39ce741 tdf#107752 admin console: indicating whether a document is modified.
Change-Id: I6055a601c1dd3b5e9700ef75d7c07d7e0b13d663
2017-05-23 19:00:53 +05:30
Aditya Dewan
f94b42d9a8 tdf#107762 admin-console: memory graph in 'Analytics' tab now working
Change-Id: I6a0ee82e813e80344eaf6ddb7d46eebed98ca5bb
Reviewed-on: https://gerrit.libreoffice.org/37672
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-05-16 17:52:53 +02:00
Ashod Nakashian
8b3a2ed9d7 wsd: reduce included headers
Change-Id: I3107b18b2edae34a76e9f56a5cbd24836b1b57c0
Reviewed-on: https://gerrit.libreoffice.org/36872
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-24 06:52:02 +02:00
Aditya Dewan
41ed318de8 tdf#106449 admin:adding user list for each document
Change-Id: Ia5c382f469a80464d0435e1e2e4de3daaba8a690
Reviewed-on: https://gerrit.libreoffice.org/36275
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-04-19 08:17:11 +02:00
Marco Viscido
0bb650e7c4 keep expired document and query them to get the historical content
A Document has its own snapshots set.
A snapshot is a string representation of a JSON object.
AdminModel keeps also the expired document objects.
Query each document object in order to get their own history.
Admin accepts an "history" command then returns a json object.
An administrator checks the history by dashboard.

Change-Id: I73c87eff334cdb5a4a58043b2b66f18a56240b3a
Reviewed-on: https://gerrit.libreoffice.org/35926
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-04-19 04:08:38 +02:00
Miklos Vajna
8958e1c767 wsd: make requestURI a const reference
It's copy-constructed from a const reference but is only used as const
reference.

Change-Id: I9a58561616bcfeff0c45803f3244f8e78d54731a
2017-04-10 10:44:14 +02:00
Michael Meeks
0806986c8c Admin model locking - major cleanup.
Do everything in the Admin Model in the AdminPoll thread.
Everything else can push work there safely through callbacks.
2017-04-03 20:42:31 +01:00
Ashod Nakashian
d77ede8954 wsd: consistent naming sendFrame -> sendMessage
Change-Id: I06c6bb42392a8982a8bb232eee33ece4c8dfc451
2017-03-29 20:03:01 -04:00
Ashod Nakashian
53da72a1dc wsd: fix hot looping the poll
When not sending ping the ping time is not set
which results in the setting the poll timeout to
a negative value, forcing it to return immediately.

This happens when sending ping before upgrading
to WebSocket, which isn't common. One way to
reproduce it, however, is to connect to the
admin console with an unauthenticated socket.

Change-Id: I9f3db1a02b8f8e2781d23d843e848068ad434958
2017-03-20 00:41:54 -04:00
Michael Meeks
a6a4094e52 Send ping message, handle pong & store ping-time on the Websocket. 2017-03-17 22:59:03 +00:00
Dewan
92ad94f259 display lokit and loolwsd version in admin panel
Change-Id: Ia5b89373bfd7e921597b73d5a84963268244b748
Reviewed-on: https://gerrit.libreoffice.org/35199
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-03-17 07:53:06 +00:00
Michael Meeks
8749f4f2e3 Cleanup unit test hooks. 2017-03-16 18:32:12 +00:00
Michael Meeks
e7ebe0fdaa remove obsolete Poco headers, and Poco SSL pieces. 2017-03-16 18:03:23 +00:00
Michael Meeks
a6de441ed0 rename AdminRequestHandler to AdminSocketHandler. 2017-03-16 17:32:38 +00:00
Michael Meeks
4bc71cc86d Admin: remove debug. 2017-03-16 17:29:18 +00:00
Michael Meeks
97cb6597c8 Admin: don't set 'secure' on auth cookie for http.
Also tweak paths to accomodate bundlification, apparently un-necessary
in secure cookie mode, interestingly.
2017-03-16 16:44:27 +00:00
Michael Meeks
d19b6eb351 Move memstats & cpustats into the main polling thread.
We can calculate the timeout ourselves easily and add it to the
polling loop simplifying life.

Also ensure we never send messages to a non-authenticated thread.
2017-03-15 17:24:44 +00:00
Michael Meeks
0089723f69 Admin: review error handling on auth. failure. 2017-03-15 16:25:29 +00:00
Michael Meeks
909b5f8ac3 Admin: should be its own socket-poll goodness. 2017-03-15 16:13:13 +00:00
Michael Meeks
e1f576bdb3 Switch to using websocket here. 2017-03-15 15:12:52 +00:00
Michael Meeks
d9980e3392 Adjust initial AdminRequestHandler entry point. 2017-03-15 14:40:24 +00:00
Michael Meeks
333f8994e9 Cleanup shutdown flag handling.
Pull the notification pieces out of SigUtil.cpp - not signal safe,
and invoked only from LOOLWSD anyway.

In a non-blocking world, the socket close notification sends are
instant - so more work required to count-down / timeout remaining
clients.
2017-03-10 10:47:42 +01:00
Ashod Nakashian
3fb136170f wsd: extend timeout when nocaps is specified
Change-Id: Id10b38716cc184bf899120bbe18d9095fd2f48e5
Reviewed-on: https://gerrit.libreoffice.org/34053
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-09 04:36:17 +00:00
Jan Holesovsky
cb3ccfe32d Fix crash on exit in the Admin console.
Change-Id: I5f90a12eb95f59d2b52a52e59526488b94975387
2017-02-08 21:39:10 +01:00
Michael Meeks
9ec0466c57 Admin - measure dirty memory of kits, and RSS of forkit.
Gives a more accurate real memory consumption for each process.
2017-02-07 18:55:32 +00:00
Ashod Nakashian
11c08d7663 wsd: remove logging of detailed memory stats
Change-Id: Id804cc342d786e745d7ac214ea72b198bf0b639b
2017-02-05 22:08:23 -05:00
Ashod Nakashian
64335b4127 wsd: correctly initialize forkit pid in Admin
Change-Id: I376742fa324f207d77fa290046657f17f8872b27
2017-02-05 21:59:23 -05:00
Ashod Nakashian
d7a9a76ddb wsd: report PSS of kit processes
Each Kit process now reports its own PSS,
which is much more accurate as they share
a significant ratio of their pages with
one another.

Admin tracks the PSS values of the Kits
and reports to the console.

Change-Id: Ifa66d17749c224f0dc211db80c44f7c913f2d6c4
Reviewed-on: https://gerrit.libreoffice.org/33864
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:12:31 +00:00
Ashod Nakashian
ae8c352928 wsd: access AdminModel instance under lock
Change-Id: I6c5c07dafa69f052ee81e7cbecb4d1f2b772fef9
Reviewed-on: https://gerrit.libreoffice.org/33863
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:08:58 +00:00
Ashod Nakashian
4eed11e2be wsd: Admin logging updated
Change-Id: I7d7e0f98f10ae3ef10ca15cf6ad510a3d7bab00e
Reviewed-on: https://gerrit.libreoffice.org/33859
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:06:06 +00:00