Commit graph

199 commits

Author SHA1 Message Date
Ashod Nakashian
4e9b836ea6 wsd: always use Util::forcedExit to properly cleanup
We need to flush and shutdown logging before exiting,
so we can't use _exit/_Exit directly.

In addition, with profiling (e.g. code-coverage) we
must flush the profile data, lest it's all for naught.

Change-Id: I726c5a2f4e699c17dd0d7d5b1c86d856e0118b3c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-08-02 07:51:52 -04:00
Ashod Nakashian
e3deda303b wsd: fix warnings on GCC 12
Change-Id: Ia61f45d83223a65d1f7c444250230006a4ac098f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-07-13 09:37:07 +01:00
Michael Meeks
a5aeac6eeb stress: dump connection count.
Change-Id: I3a1a4202d8f3cbabaf46794fa1c3452af1470016
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-10 10:10:05 +01:00
Michael Meeks
fe5100183c reply: record more statistics.
Count data sent as well as received, re-factor, and measure B/W
usage too.

Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I5d00f0568c774cc03d2b8e4f730bfe4a8fb5b06f
2022-06-08 09:18:05 +01:00
Michael Meeks
55a47214d1 stress: account for the size of each message.
Change-Id: Ie94add7197672106a2c0684405a1b15c307470e4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-06-06 09:58:15 +01:00
Ashod Nakashian
14d96957cd wsd: log macro cleanup
* Simplify log macros.
* Reduce expanded lines (faster compilation).
* Avoid flushing (since we always use ostringstream).

Change-Id: Id10c1a75b5af5d8cdba62d768192ab0a6a9e0aca
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-26 11:13:44 +03:00
Ashod Nakashian
480fb7b931 wsd: move tokenizer helpers into StringVector
In an attempt to reduce the size of Util.{c,h}pp
which has grown to contain all sorts of unrelated
helpers, we move StringVector helpers into
the StringVector.{c,h}pp files.

This makes the code better organized.

Change-Id: I152f341606807ae66253415b951bc9f89b09df57
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2022-04-12 07:39:07 -04:00
Michael Meeks
6548759fde replay: re-connect after a timeout for various errors.
Change-Id: I06cb01a0ab826b5723e634bb03e1bca6d99c4db2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-04 10:06:33 +00:00
Michael Meeks
019913666d Replay: log which client a message is from / for; and improve errors.
Change-Id: Id9e7d9680a0c33d79c8f691222829406754eaf94
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-03-03 09:04:06 +00:00
Michael Meeks
0678082db4 Detect trace replay errors & exit and cleanup traces.
Change-Id: I15c04eb9eef02f3f6002c35dc5701b7dbe9a1398
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2022-02-21 15:37:05 +00:00
Gleb Popov
34574724b4 Teach coolmount to mount devfs on FreeBSD.
Use it to create /dev/{u}random devices instead of calling mknod().

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I6ae7842c89255f3f43a8ac7f082a275d5496690a
2022-02-21 10:20:01 +01:00
Michael Meeks
60b76efe82 Count bandwidth use during stress testing.
Change-Id: I48e1540795f0992833d4c4365d4a9d0da7a48442
2022-02-15 19:44:08 +00:00
Miklos Vajna
8e2829fee7 tools: fix -Werror,-Wfortify-source
'sscanf' may overflow; destination buffer in 'smap_key' has size 20, but
the corresponding specifier in tools/map.cpp:570 may require size 21.

Change-Id: Ie7356db924193777869a39b882512a864c0e10c5
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
2022-01-24 12:33:23 +01:00
Aron Budea
2faa5459ce coolconfig: migrate missing entries in special cases
Also fix ssl.hpkp.pins.pin handling.

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I48ffe3db9ec0ff2db53f5e8cac5ec3d7aa55e66c
2022-01-17 10:16:06 +01:00
Andras Timar
e543581887 coolconfig: allow set command to create new config settings
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I1efcca7a773df366a2cca1d56f1d6fb967402deb
2022-01-17 07:00:58 +01:00
Aron Budea
3ec29a474e coolconfig: Updated "host" entry handling in migration tool
- new method for migrating "host" entries:
  only done if there are new entries in the old config,
  and then replace the list in the new config with the old one

- other small changes, eg.
  don't migrate special default values if they match target value

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: Idf43db4068c163077109825486855a259666181c
2022-01-12 09:49:43 +01:00
Aron Budea
c6155a3513 coolconfig: Add config migration tool
Usage:
coolconfig migrateconfig [--old-config-file=<path>]
  [--config-file=<path>] [--write]

Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I44e16bd07588887e01732b430e4c6e368a034cd1
2022-01-10 20:11:26 +01:00
Gleb Popov
a169580d53 Actually pass freebsd_flags variable to nmount() call.
Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I5149b30e8dc6c2ed13c964f8bcf44399565c4f66
2021-12-09 15:24:47 +01:00
Miklos Vajna
dcfe16eec1 coolconvert: fix stack-use-after-scope
The vector is allocated on the stack in a for loop, so it's not valid to
refer to its address in the lambda that is executed on a thread. Rather
copy it.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ie1f85d6efb27a4aa44b181f8d9f134e9fa41d508
2021-11-19 12:41:28 +01:00
Andras Timar
f07ff8c7e0 rename: remaining lool->cool changes
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: Ib7d4e804bebe52dead8d53b0e0bbaed0f08bf3d0
2021-11-18 14:14:11 +01:00
Andras Timar
504c05df3b rename: loolwsd-systemplate-setup -> coolwsd-systemplate-setup
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I699db87f94f9080909c2ca783e04ad8b4dd98025
2021-11-17 22:10:58 +01:00
Mert Tumer
b59fbe8d4c rename: loolmap -> coolmap
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: I3136305d5733c5c7a886baa230fd4c1e1401b734
2021-11-17 21:51:05 +01:00
Mert Tumer
c9a4d2f6f3 rename: loolmount -> coolmount
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ic025c5a76c6f27cdf1a6267f24cf8052733f1f24
2021-11-17 21:51:05 +01:00
Gleb Popov
fdfdd59097 loolmount: Mimic the Linux behavior of umount2() on FreeBSD.
On FreeBSD the mounting operations are allowed to be performed only by root
by default. When `loolwsd --cleanup` is called during normal compilation process,
it tries to unmount "jails" directory and spits EPERM-related errors.

Fix this by checking if the directory being unmounted is actually mounted and
return EINVAL in this case, just like Linux unmount2() does.

Signed-off-by: Gleb Popov <6yearold@gmail.com>
Change-Id: I0f72d265e33fb1e6129332bfa8e17e7d888d30b5
2021-11-17 12:07:33 +01:00
Henry Castro
85ba63ddce misc: more renames 'lool' -> 'cool'
Change-Id: Ic9fbae88d92921b9081e7067347852e385f45af3
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:46 +01:00
Henry Castro
d4a69adf9e tools: rename 'lool' -> 'cool'
Change-Id: If567c65742df325d9999ea711ac642c07cd232c8
Signed-off-by: Henry Castro <hcastro@collabora.com>
2021-11-17 09:17:12 +01:00
Mert Tumer
78ccaa845e rename: loolconfig -> coolconfig
Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Ied23cb46a668f754931fc125745b674b546a0195
2021-11-15 22:07:53 +01:00
Luboš Luňák
897c5df270 make Socket use Buffer for input buffer too
SteamSocket::eraseFirstInputBytes() removes from the beginning
of std::vector, which is generally slow. If the buffer becomes
too big, which it may under a load, then the function will get
slow, which in turn will likely lead to the buffer getting even
bigger because of accumulated backlog.

The Buffer class is optimized for removal at the beginning,
so use it instead of std::vector, including some API additions
for it to be an in-place replacement where it's used.

Signed-off-by: Luboš Luňák <l.lunak@collabora.com>
Change-Id: I4cf7ec56c908c7d3df391dc3f8e230ad32abb162
2021-10-26 12:11:58 +02:00
Michael Meeks
b043b6213d Move LOOLWebSocket into test/ - where it can be slowly removed.
Change-Id: I388690261d323377648a1502b927e73f862ad802
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Michael Meeks
a2055d2023 Move StressSocketHandler into Replay.hpp and share with wsd's fuzzing.
Change-Id: I01e0fd0b666651101055b1e78ec6c10e721d114b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-11 13:40:20 +01:00
Michael Meeks
4b200a11b5 stress: remove older code-paths and make the help helpful.
Change-Id: I3fe58c4e3e1a6b633fa4e94ba66db2d4bb465699
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-05 15:59:54 +01:00
Michael Meeks
fa3a975a59 stress: replay slowly when running under valgrind.
Change-Id: Iecd58e3929b3801e7ba7ce3ae171758d91f1037b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-02 21:24:15 +01:00
Michael Meeks
72f8f5d30e stress: store and dump some statistics.
Change-Id: Ied5eb12888b1466c155ecfd291785a95ea897db9
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-10-02 21:24:15 +01:00
Miklos Vajna
4b88948741 stress: dix disable-ssl build
test/test.cpp and wsd/Storage.cpp has the same pattern.

Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: Ic1dfbd3a5368eb9831bde9d77ea1bb813834d42b
2021-10-01 09:50:38 +02:00
Michael Meeks
e5bbfc6397 stress: Initialize SSL
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I014d6a357f5d089f7c89f2d2441c5a30df5a0df4
2021-09-30 10:34:34 +01:00
Michael Meeks
2186a97b95 trace: re-write load url=<foo> to the requested file.
Change-Id: Ia446199ef97d2cdc6768af93a605bc8f67aef238
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00
Michael Meeks
61325af304 trace: finish when all traces are played.
Change-Id: Ib20169b54fcd5b8656470ed4cee89170c85ee7a0
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00
Michael Meeks
ac74ed5f91 trace: respond to tile: messages with tileprocessed:
Change-Id: Ie35b901e643172a05c2cf3a325d878f54cf6fff4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-13 14:54:00 +01:00
Michael Meeks
6f6ccbf228 trace: prettier replay.
Change-Id: I169bc51fce0229843d38caa6311aedb993c2ce2d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-10 22:45:29 +01:00
Michael Meeks
ef8d648c33 trace: turns out timestamps are micro not nano-seconds, rename API.
Change-Id: I0be1eddab3d67045e74cf89992973abf041beee4
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-10 22:45:29 +01:00
Michael Meeks
b1ca17f5c9 stress: more work to base on SocketPoll.
Change-Id: I3da8f8fef6df245617620955e09fbcf03ab31bdc
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-09-08 12:47:34 +01:00
Tor Lillqvist
77b877c027 Bin misleading ERROR message
There is one EndSession record for each session that edited the same
document. That is not an error.

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I9042411ad465fe07a8f88a29923f0dc051c755aa
Signed-off-by: Tor Lillqvist <tml@collabora.com>
2021-08-30 13:41:21 +03:00
Tor Lillqvist
10ef641889 I think the delay variable needs to be signed
I otherwise get values like this:
    epochFile=18682409
    deltaCurrent=34
    rec.getTimestampNs()=18682409
    deltaFile=0
    delay=4294967262

Leading to the idiotic:
    Sleeping for 4294967 ms

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I06530c31bc70bb7dcf3cd34c4684aa9f1f8036cb
2021-08-26 14:05:02 +03:00
Michael Meeks
9f4ee5d450 stress: start to implement based on SocketPoll.
Change-Id: I6fba41c826ab70b1f653f6511dac32f10f998259
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-08-17 19:19:46 +01:00
Ashod Nakashian
f63d077916 wsd: ssl certificate verification requirements
Change-Id: I72ffa586310296f1986276c3007672c41146c92b
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
f702c4efab wsd: support certificate verification
Change-Id: I912595f104e24dc66da9cf06bc211cb0c50c9ff0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-07-18 21:14:48 -04:00
Ashod Nakashian
5a310a2232 wsd: separate client SSL context from the server
Change-Id: I4d86f733a16e6c76340b18ff836831ebe6acfd4d
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
2021-06-23 23:39:34 -04:00
Tor Lillqvist
d6569159b7 Output a Trace Event metadata event identifying each named thread
Move the generic dummy implementation of
TraceEvent::emitOneRecording() to a source file of its own. (That is
the one which is used in test and tool executables.)

Signed-off-by: Tor Lillqvist <tml@collabora.com>
Change-Id: I81cab07e5a6852b42d278a5446c13c3825cf546e
2021-06-21 12:43:17 +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
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