Commit graph

1859 commits

Author SHA1 Message Date
Ashod Nakashian
c6f7e3758f wsd: typo
Change-Id: I0b9e17c1963636855a3360df57747dec8f9e4aa2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-06-13 21:57:43 -04:00
Ashod Nakashian
e8a52959ea wsd: document ModifiedTime getter/setter
Change-Id: I95763c62d5937f0749604ab26d530e85c2ed105e
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-06-13 21:57:43 -04:00
Miklos Vajna
8f1621299b wsd: guard against negative counter in loolclient cmd
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: If1b1b515015b8aae01f2d1a6cb6a98426e2b03a8
2021-06-04 14:31:57 +02:00
Tor Lillqvist
cfa3de6aa4 Add the thread name also to Trace Events from the client without args
Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Ica43ea4c2043ba74f7eb912e81a2c38244271933
2021-06-02 09:04:21 +03:00
Tor Lillqvist
8cef48a0fa Introduce a generic TraceEvent class and instant events here, too
Modelled on how it is done in core. ProfileZone is derived from
NamedEvent which is derived from TraceEvent. Here we don't keep any
separate ProfileZone.hpp, though.

This was needed to introduce generation of "instant" events here, too.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6583134e96001641c50339deb4197fca6ab7d5d5
2021-06-02 09:04:21 +03:00
Henry Castro
d118500a70 wsd: revisit log messages ClientSession.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I4ab8d04099a432e7fd3fb6810d7a9aa038cbb57d
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-06-01 14:15:30 -04:00
Tor Lillqvist
5e9e0d620e Add a ProfileZone around two more WopiStorage member functions
As requested by mmeeks.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: Iba04bc5255479b9b0998a385d558bf07279bf00c
2021-05-31 15:33:23 +03:00
Tor Lillqvist
eee8fe99d5 Avoid maximum/minimum logging level terminology for newly introduced settings
(Also in variable names.)

Better to just use terms that say what we mean, i.e. most verbose and
least verbose.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I80d74fda8b80bd34d194c3df97d246a41368189b
2021-05-31 15:06:57 +03:00
Miklos Vajna
c415fcbcce Add an Android setting for the user's name or nickname
This was already worked on iOS since commit
75a3ab02ca (Add an iOS setting for the
user's name or nickname, 2021-04-07), start using the same API on
Android as well.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I37825d143b0ed92bd84f9a1512313e51ff5e761c
2021-05-31 10:45:32 +02:00
Tor Lillqvist
b7ca93a41a Add the possibilty to set a thread-local logging level
Add a way to set it from the client.

For now, in the Help > About dialog, the L key toggges the logging
level between the default (whatever is set in loolwsd.xml or on the
loolwsd command line) and the maximum a client is allowed to set
(which also can be set in loolwsd.xml or on the loolwsd command line).

Also while at it, uncouple the toggling of the Trace Event generation
from the triple-click tha toggles tile debugging. It is now on the T
key.

Also swap the meaning of "min" and "max" for the logging levels. Even
if the Poco::Message::Priority values are such that the less urgent
priorities have a numerbcally higher value, conceptually it is more
clear to say the more urgent priorities (levels) are "higher".

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I5383b16ead7d2d378901525eb0d16513d88f045e
2021-05-31 10:56:19 +03:00
Tor Lillqvist
636069430e Also add logging.min_level_settable_from_client
We don't want a client to be able to turn logging off completely
either.

Note, just to avoid potential confusion: This is about the LOG_INF(),
LOG_WRN(), LOG_TRC() etc logging here in Online. Not related to my
recent work on Trace Event format logging.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I3de527cb9f69d9a5269b1db2e1d4602e7117f22e
2021-05-31 10:56:19 +03:00
Tor Lillqvist
4136e024f9 Add logging.max_level_settable_from_client setting
(Not used yet.)

The intent is that the JS code will be able send the server a message
that adjusts the logging level for the WSD thread(s) and Kit processes
handling that client.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I88ac301f002b1f3a55a5d8c9e3650babdedc1e0d
2021-05-31 10:56:19 +03:00
Tor Lillqvist
2398c792cb No Hungarian notation please
I had accidentally used core naming conventions for ProfileZone.

Change-Id: If10eceb7a5a29d26662d5b21a9289681d814a12e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-31 10:56:19 +03:00
Tor Lillqvist
496951d2c1 Add a ProfileZone for WopiStorage::getWOPIFileInfo
On request from mmeeks.

Change-Id: I2b0b6e290109b29cd84359b2c26aa30357e8450f
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-31 10:56:19 +03:00
Tor Lillqvist
929e466c91 Re-work the ProfileZone implementation here
Don't bother collecting them into a vector, like in core. Instead,
just call a static member function ProfileZone::addOneRecording() for
each Event Trace object (string) to be emitted. That function then
needs to be implemented separately in each executable. In WSD it logs
the object to the Event Trace file. In Kit it sends it to WSD for
logging. In Unit tests we use a dummy implementation.

(If Event Trace logging is not enabled at all in loolwsd.xml (the
default), nothing is done, of course.)

When receiving the "traceeventrecording start" or "traceeventrecording
stop" message from the client, turn ProfileZone recoring on or off in
the WSD and Kit process. (Probably in WSD the flag should be
per-client.)

Change-Id: Ie1127d65dd44ed77e7eeab4b0f0a90cce95dc4a2
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-31 10:56:19 +03:00
Miklos Vajna
bc0401fc49 Make sure that double fits into uint64_t
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic521383f71c1865ae18fc880b79493c52285e29b
2021-05-31 08:54:06 +02:00
Tor Lillqvist
809c78480d The convention is to call the processes 'WSD', 'ForKit', and 'Kit'
I.e., not in upper case. I was misunderstanding.

Change-Id: I3275446cba0eb954b5ef398d3406d0543c2fb7e7
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-25 10:41:11 +03:00
Tor Lillqvist
d5ded73b11 Fix FreeBSD compilation error
Change-Id: I0201c8213c9593f225c0aab7c4e95b06bd6a22ec
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Tor Lillqvist
9b948da419 Add thread name and id to Trace Events coming in from a client loleaflet
Change-Id: If469fcfb39b94866e8d8a93a88587c33583b35d2
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Tor Lillqvist
9c6b74ad08 Use a loolwsd.xml setting instead of --enable-trace-event-logging
That is our convention, and this also avoids a global variable in the
kit process.

Change-Id: I37d2d53aa7eb24f9848fa8ef98bc57d75db90d13
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Tor Lillqvist
cadb005993 Add the possibiliy to include arbitrary arguments in the generated Trace Events in JS, too
For now, an argument object should have all keys and values as strings
not containing any spaces because of the trivial way in which it is
parsed.

This is a bit sad, yes, but necessary until we move to some more
structured syntax for the messages.

Also fix an incorrect comment.

Change-Id: I8a1408a4a1787b66a3cf7b26b3d92c07df244c47
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-19 13:33:26 +03:00
Miklos Vajna
03f13aceb1 wsd: remove unused using declarations
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I99aa27d70c7c1d90f3048009644ebf9a41e73724
2021-05-14 11:05:16 +02:00
Andras Timar
9a522cf0db documentation of default config values
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ie7022e0db125f85261f17cfa91933fe8d3b51104
2021-05-13 11:52:20 +02:00
Tor Lillqvist
a28ee1bac6 Fix syntax errors in generated Trace Event JSON
Colon, not equals. Comma missing.

Change-Id: Ife64fe7c57e0cff155926f9b17beb17ce530d848
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-10 18:06:59 +03:00
Tor Lillqvist
4e0b03f651 Let the server tell loleaflet whether trace events can be collected or not
Instead of requiring that information in the query string of the loleaflet.html URL.

Change-Id: I8c41e87c7f561561adeb03ec34ce0c19fe9d7fa5
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-10 16:44:07 +03:00
Tor Lillqvist
cdf374dc63 Clarify Trace Event file writing
Make it contain a proper empty JSON array if no trace objects have
been written to it.

Change-Id: Ided1992a822659561a909ac545536261b91adbac
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-10 15:14:40 +03:00
Tor Lillqvist
9da0145280 Add an --enable-trace-event-logging option to loolwsd
It enables turning Trace Event recording on (and off again). The
option is passed down to the client through loleaflet.html, and to the
KIT processes. If the option is not used, the new JS functions that
send trace events to the server turn into no-ops to avoid wasting
bandwidth.

It is always on in a "make run".

Change-Id: Iafe1919ccba7c376137d3e0568b857e20780bbc8
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-10 12:39:07 +03:00
Miklos Vajna
7b89ce2961 ClientSession::_handleInput: avoid pointing to a temporary
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I048ce322111029847d78f917f071b1c0854dc116
2021-05-10 12:38:32 +03:00
Miklos Vajna
d6c41de084 ClientSession: fix -Wdangling-gsl
wsd/ClientSession.cpp:411:31: error: object backing the pointer will be destroyed at the end of the full-expression [-Werror,-Wdangling-gsl]
            const char* str = tokens[2].data();
                              ^~~~~~~~~

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I67e4aa5f61e049ad13663dc1e11ae2bd67399bea
2021-05-07 13:42:54 +02:00
Ashod Nakashian
effa9b942f wsd: log if we skip updating the modified flag
Change-Id: Iadde822ce720ff81abd38fd7c8991352ac57953f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-06 22:14:51 -04:00
Tor Lillqvist
9c57b8a435 Introduce a TRACEEVENT message from client to server
Add a function emitInstantTraceEvent() to leaflet that sends an
"Instant" Trace Event to the server for logging.

Add a function createAsyncTraceEvent() that creates an object that
records the timestamp of its creation and sends the 'b' event to the
server for logging, and when you call finish() on the object, sends
the corresponding 'e' event.

Finally, add a function createCompleteTraceEvent() that creates an
object for a "Complete" Trace Event that includes the end timestamp
*and* the duration. The event is sent to the server when you call
finish() on the object.

Loleaflet sends timestamps in the above messages from
performance.now(). To enable the server to turn those into absolute
timestamps, the loolclient message is amended to include the current
Date.now() and performance.now() values.

Note that the intent is that when generating Trace Event logs, the
server and the web browser run on the same machine, so there is no
wall-clock synchronisation issues between server and client.

Change-Id: Ie9e68b093b769cc942e1e1d17083febeb07ccf5e
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-06 11:24:20 +03:00
Michael Meeks
d387700914 Message: don't generate and allocate abbreviations just for trace logging.
Also avoid generating abbreviations in various message handling loops
unless debugging is enabled.

Change-Id: I22f4929b0bfd4da36917db6882bb2f5f5be02780
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-05-05 09:40:10 +01:00
Tor Lillqvist
686f1ba1cb Make WebSocketHandler::_isClient const and drop default values for bool parms
Avoiding default values for parameters makes the code easier to read.
Especially true for bool parameters. But sure, just a question of
taste.

Change-Id: I473f70bdfafe3a9ccfb325def8760d78fee7e9a6
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-05 09:03:29 +03:00
Henry Castro
4e7fadb2b5 wsd: revisit log messages LOOLWSD.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I80e8ee0de2b6858ec8e1c27276eb2058acdb2970
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-05-04 10:44:01 -04:00
Tor Lillqvist
fd1910c727 The Chrome format is called Trace Events, not Event Trace
Change-Id: I2515182d9369c3a25727dce0d3790e79de891bff
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-04 15:12:14 +03:00
Tor Lillqvist
eb9c580c36 Introduce ways to toggle and tweak core Trace Event recording and logging
When toggling tile debugging in the Help>About, toggle Trace Event
recordning, too. Add a comment with an example of how to turn on
SAL_LOG overriding at the same place.

The following new messages from client to server are introduced:

traceeventrecording <start/stop>

    Starts or stops comphelper::TraceEvent recording.

sallogoverride <string>

    Overrides the SAL_LOG value, or stops overriding if no parameter
    or parameter is "default".

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I8b56c28cd99d39115cd796c44e5051d934d21a1f
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-05-03 16:09:35 +03:00
Tor Lillqvist
be476d23b3 Produce a Chrome Event Trace file
It is (for now) produced (by the ProfileZone things in core) whenever
logging level is "trace". The Event Trace file pathname can be given
in the loolesd.xml file or on the loolwsd command line.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I6d5829121e71460a4600ee94d2ebf51043c8893f
2021-05-03 16:09:35 +03:00
Ashod Nakashian
0dbecddb3a wsd: http: simplify sending response and shutting down the socket
Change-Id: Id4e32c8eb79458d060767a7a5ac26476e2f84331
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-02 22:35:39 -04:00
Ashod Nakashian
a21120412e wsd: explanation comment
Change-Id: I5104db5d20049132f88ca15a713bb3c17fb2d32d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-02 22:35:39 -04:00
Ashod Nakashian
e0b5cddffc wsd: shared_ptr can dereference directly
Change-Id: Ie958c2c79da0b3ffa19de0c633e486a390240409
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-05-02 22:35:39 -04:00
Ashod Nakashian
4e7b0b10fe wsd: simplify assertion
Change-Id: I2cac7543fa20a39deba447e67e9c9cdb08cd3572
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
(cherry picked from commit 7188d4013a8bf00379610ec1b0a610c555674a2d)
2021-05-02 22:35:39 -04:00
Ashod Nakashian
c5490f628e wsd: enable fat writes in WebSocket
This enables writing multiple WS frames
at a time, up to the capacity (rounded
to the next full-frame's size).

Change-Id: I30d25f9ba1e405156d1e44886b2f3ac8017f0f3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 17:48:23 -04:00
Ashod Nakashian
3decba7eec wsd: specify the minimum bytes we can write to the socket
When writing to the socket, it's always more efficient
to fill the buffer up to the hardware limit for each
write. This is doubly important for efficiency with
SSL, due to the overhead of encrypting multiple
small buffers instead of one large one.

Currently we don't write more than one message
at a time, primarily due to limitations in
the Poco sockets in the unit-tests, which
have a hard time consuming multiple WS frames
with a single poll (subsequent calls to poll
doesn't enter signalled state until new data
arrives, possibly because the data is read and
buffered internally, making the whole scheme
of using poll unreliable and meaningless).

Change-Id: Ic2e2cf1babfb5ab4116efd93f392977ba234d92b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 17:48:23 -04:00
Miklos Vajna
d3c9e07ff3 StringVector: add a way to get a string-number pair out of this ...
... without copying the token.

And use it in TileDesc::parse(), which is known to be a hot path.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I0dcf2eb26c93254cdc6a1c11f9708daf213a825d
2021-04-27 15:31:21 +02:00
Miklos Vajna
c11f0e5708 StringVector: add a way to get a number out of this without copying the token
And use it in TileDesc::parse(), which is known to be a hot path.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I20375d7a1c31f61662446979e4d6799fd45b49d3
2021-04-27 15:31:21 +02:00
Ashod Nakashian
ade93f5f57 wsd: more informative initialization failure log
In some rare cases Poco throws "Exists" exception.

It's not clear what causes it, so this should
log more of the original exception, hoping that
it would shed some light.

Change-Id: I51723f35c9e062c56608e8f7b80c9a65d3f0488f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
6444c35d21 wsd: mobileapp: fix a warning
Change-Id: Ie710a76f3cd5d96056648815ffe393ab2e58ac78
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
c50af5b94c wsd: better and consistent logging of ShutdownRequestFlag setting
Change-Id: Ic9e41d193b6a6a678170ec5ca30bd80bcee04c80
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Ashod Nakashian
9742f91527 wsd: log the reason for terminating DocumentBroker
Change-Id: Ieef1d30bd4abc18e27cc057ac2374f730b8992c2
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-04-27 08:09:49 -04:00
Henry Castro
21c66b2352 wsd: revisit log messages DocumentBroker.cpp
LOG_FTL = abnormal, crash, denied service
LOG_ERR = load, save, session, connection, wrong parameters
other cases LOG_WRN, LOG_INF

Change-Id: I174a86f48e6b4107d0f846fd9af28a7ab1f62afc
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-04-15 10:53:00 -04:00