Commit graph

84 commits

Author SHA1 Message Date
Ashod Nakashian
477d6714d9 wsd: SessionId -> ConnectionId
"Session" is too generic and can be misleading.
This is really a connection ID, or a connection-session ID,
so it's more sensible to call it ConnectionId to
signify that it's a connection-specific ID.

Change-Id: I0f12b1cf80d4853a27535101093ef6b7a3e0d438
Reviewed-on: https://gerrit.libreoffice.org/79326
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2019-09-22 20:20:24 +02:00
Miklos Vajna
1263694944 common: wrap ShutdownRequestFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
ShutdownRequestFlag:

==13663==ERROR: AddressSanitizer: odr-violation (0x00000208f860):
  [1] size=1 'ShutdownRequestFlag' ../common/SigUtil.cpp:60:19
  [2] size=1 'ShutdownRequestFlag' common/SigUtil.cpp:60:19
These globals were registered at these points:
  [1]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f9b903f1d0b in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60ad0b)

  [2]:
    #0 0x5f9a18 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b9fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b9fe)

Change-Id: I247760325f804813249e814dbb4576493619dee7
2019-08-12 09:03:42 +02:00
Miklos Vajna
bd4d72d41f common: wrap TerminationFlag in a getter function to avoid ODR violation
Otherwise both loolwsd and unit-copy-paste.so would have a
TerminationFlag:

==11732==ERROR: AddressSanitizer: odr-violation (0x00000208f4a0):
  [1] size=1 'TerminationFlag' ../common/SigUtil.cpp:41:19
  [2] size=1 'TerminationFlag' common/SigUtil.cpp:41:19
These globals were registered at these points:
  [1]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0x7f5df9cf18cb in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/test/../test/.libs/unit-copy-paste.so+0x60a8cb)

  [2]:
    #0 0x5f9988 in __asan_register_globals.part.13 /home/vmiklos/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_globals.cc:365
    #1 0xe2b4fe in asan.module_ctor (/home/vmiklos/git/libreoffice/online-san/loolwsd+0xe2b4fe)

Change-Id: Ic620b143ecb77699f40676ff39d0fa7abceb34d5
2019-08-08 09:10:59 +02:00
George
360d5a0956 added server uptime field to admin console
Change-Id: Id23fee1299b87095f186ce7aaa8c2d2e0f3cef52
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2019-07-19 21:14:01 +01:00
Michael Meeks
289894c66c debug: show WebSocketURI & a unique host id in help -> about.
Rather useful for debugging clustering issues.

Change-Id: I6d5f224bf8a3e4034c419137c8ad2b17fdf265ed
2019-05-17 13:24:32 +01:00
Miklos Vajna
8244726d39 MonitorConnectRecord: make members private
Change-Id: I485ed48bca0e5c2c0be15f44f553fc48651c59c9
2019-01-09 08:45:53 +01:00
Miklos Vajna
d00c638298 DocProcSettings: make members private
Which shows that LimitDataMemKb was an unused member, so remove it.

Change-Id: I48c9a5df09b78e5fc267550219d7f4c78a03ec01
2019-01-08 09:05:46 +01:00
Miklos Vajna
5c443ca7d9 DocBasicInfo: make members private
Nicely shows that all these members are only set once in the constructor
and otherwise only read.

Change-Id: I4b48a9d0faa50efc4bec30ce94239b7438bbf889
2018-12-21 09:07:40 +01:00
Tomaž Vajngerl
73c8fa9d09 Extract Authorization out of Auth and put it into common
This is needed so we can use this inside ChildSession.

Change-Id: I88f2cc767412fd52dbb242938f0f9897d4277639
Reviewed-on: https://gerrit.libreoffice.org/63836
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
2018-11-29 21:47:13 +01:00
Miklos Vajna
d1e183f20d SocketPoll: make members private
All these protected members are unused by child classes, except read
access to a single member.
2018-10-29 09:06:33 +01:00
Andras Timar
2d62529359 don't use ssl key file for admin console auth, use a generated key instead
Change-Id: I424afe0184a64b7f069d896bde6941e42b7b5531
rational: setup is easier in case, when user does not use ssl in loolwsd config
Reviewed-on: https://gerrit.libreoffice.org/61076
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2018-10-05 16:38:46 +02:00
Miklos Vajna
8ad281e12f wsd: avoid unnecessary value parameter 2018-07-09 09:11:20 +02:00
Jérémie Lesage
f084ea53f6 Ensure all sessions have a sessionId and are subscribed.
Simplify constructors, and factor out subscription code.

Change-Id: I4f3ed1eb06abec193d6db1f7c78815ffe1e1b5aa
2018-06-29 18:10:03 +01:00
Michael Meeks
a521527777 Fix logging a little.
Change-Id: I858ffb40e071eae3907eeff9c2d6291fd805dc02
2018-06-15 17:38:12 +01:00
Michael Meeks
7475120c81 If a monitor is dis-connected, try to re-connect it.
Change-Id: I04f254acfe823f07e7fb11b277e661c09e146ebd
2018-05-18 17:35:19 +01:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
Michael Meeks
9e7dff79f3 re-factor socket factories to take a client parameter.
Change-Id: I0be98eb583b4f8081dd8ad23e688e93c55220367
2018-05-18 15:16:39 +02:00
Michael Meeks
80a13a1e7b More work on client / Monitor websocket connections.
Change-Id: Ic70fe522e24f2b1863c2d9d1dd6941785510758a
2018-05-18 15:16:39 +02:00
Michael Meeks
b483f477dd Allow a 'monitor' to be connected to remotely if configured.
So far monitors have the access an permissions of an
authenticated admin.

Change-Id: I59dfa8a646a60584a5c113ee0521e9afba4f6b76
2018-05-18 15:16:39 +02:00
Michael Meeks
bb49e17e8f Start the admin thread even if it is disabled.
The admin thread does memory cleanup as well which is required.
This also reduces logging churn.

Change-Id: I1c6cfaf6085b685f230dc24ae1716b0256d892f8
2018-05-15 10:58:02 +01:00
Michael Meeks
ce06a9ae37 Allow the Admin console to be disabled in the configuration.
Change-Id: Iacde8e891f42e9ef9399ebbebbd2b2978188d4c4
2018-04-17 20:47:17 +01:00
Miklos Vajna
e5c7c62713 'static const int' needs an explicit definition in C++11
core.git equivalent situation is e.g. SwXMLTableContext::MAX_WIDTH.

Change-Id: Id6f4201e875a7453ab2363161ea9560ae6e40384
2018-02-26 16:34:01 +01:00
Ashod Nakashian
88619a323f wsd: reduce memory load only when the footprint changes
Update the network interval when updating the memory interval,
since we currently don't support changing the network interval.
Also make the default memory and network interval twice
that of the cpu interval explicitly.

Reduce logging noise a bit without losing information.

And some const-correctness and other cleanups.

Change-Id: I313fb2882675f560091e5113dbdcbdef269828e2
Reviewed-on: https://gerrit.libreoffice.org/49571
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 22:16:50 +01:00
Miklos Vajna
1dde430bcf wsd: spell out non-trivial autos to improve readability
Change-Id: I0e1f169fc39e5c722704e1cae487147d929f7350
2018-02-07 10:18:12 +01:00
Ashod Nakashian
59398af621 wsd: simpler and more efficient OOM killing
Change-Id: I118abdffba4e7ab57fe6a29a3a9fc420d871bdc0
Reviewed-on: https://gerrit.libreoffice.org/47738
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-11 08:12:09 +01:00
Ashod Nakashian
0d7e153643 wsd: limit how frequently we collect admin stats
These stats aren't free and here is little point
in either being hyper accurate in the timing nor
to allow admins to set nonsensical values (such
as a few milliseconds of interval).

We cap the interval to a sensible 50ms and reduce
some of the logging as well.

Change-Id: I66b4be99cf27d135ca267cb497a7a7d07ff437b6
Reviewed-on: https://gerrit.libreoffice.org/47737
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-11 08:08:30 +01:00
Ashod Nakashian
b0fa4c33cd wsd: pass lambda args by value
These callbacks are executed on a different thread
and passing by ref is clearly invalid (and unintentional).

Change-Id: I02e5359594f912baf67028202e6262d74b5769eb
Reviewed-on: https://gerrit.libreoffice.org/47624
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-09 04:13:31 +01:00
Ashod Nakashian
57d535b15b wsd: lambda cleanup and better readability
Change-Id: Iabb850be7a7c162847514ee0fb600297accfcffb
Reviewed-on: https://gerrit.libreoffice.org/47364
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-06 22:13:50 +01:00
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