It appears that both cypress and the C++ WOPI tests are extremely
timing sensitive, and fixing this should not hold up merging the
logging improvements. So for now don't disable logging in these modes.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I43e8397263e6960b668a29e7ad67f45394c52b52
Add logging.disabled_areas setting to coolwsd.xml with some sensible
things to ignore unless they are warnings/errors.
Kit code duplication around logging is grim; but not fixed in this
commit.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I36bebb2b3c8d64a814d7b10c167d582de0baf4e5
If we had a tilecombine processed in the same queue and before
a save - the 'render tiles at the end' state would be inherited by
the background save process and result in excess work, and also
binary messages where only text messages are expected returning.
The rest of the queue is cleared post fork.
Add unit test - plus hook to hold queue processing.
Change-Id: Iee937897000bc3ac149599844f1eab005affb131
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
This should cleanup jails more quickly.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I2f7c7753614f0845a4d81d69334834047d661e41
Free CPU cycles for interactive processes.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I9d8cfe5f3541c9424d51c69380e1c72920154ff4
safeRemoveDir is tries to unmount blindly, so there
is little point in erroring when the directory
in question isn't a mount-point at all.
Change-Id: I6db0fd9406493060ce52a69f7d935b0958e2d2be
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This is not common code, it's used only in the Kit.
Rename TileQueue -> KitQueue as well as unhelpful member variable naming.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If158597f99f302cbc27e8eab139972f57a2fc3bb
Avoids unhelpful virtual methods which are not used anywhere, simplifies
several code-paths, improves readability, and perhaps performance.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I7528fab77698546545bf81d7ccacdda9a0002833
The MessageQueue is not a generic message queue, it has much more
un-anticipated functionality; so don't use it where we don't need to.
In particular unexpected re-writing and merging of messages
during tests is probably not a great idea.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I657738307e611be18f5f83e11c055bf8a88826da
Force background saving in the config for this test.
Use stamp files to force sequencing between Unit test and Kit.
Change-Id: Ia2c60c3dcfdad87c9c9754e8f20a3c36dbcf74d5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
When export is disabled or watermarks are enabled, presentation in readonly mode
is disabled.
This is checked in the frontend by the WOPI property `DisablePresentation`
that is synthesized in the wsd. Also check when calling the presentation
command.
WOPIFileInfo::getWatermarkText() is stubbed on mobile.
Signed-off-by: Hubert Figuière <hub@collabora.com>
Change-Id: I4f7aff9f670f7523dfcf396f6009a272df9d5af8
We need to get more helpful structure into this message, and add a
type=bg flag to handle background progress messages.
Add unit test for merging progress: setvalue commands.
Simplify ProtocolHandler sendTextMessage with a std::string wrapper.
Android code needs manual testing.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I54ce807e2fc5de80118905e68557a95e637fbd18
coolforkit: common/Log.cpp:677: void Log::shutdown(): Assertion
`ThreadLocalBufferCount <= 1 && "Unstopped threads may have unflushed
buffered log entries"' failed.
Was caused by mis-accounting. Also join document threads on 'exit'
which happens during unit tests to ensure we don't hit the above.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I523e723e54e4252ae0d65de36af086e97dd79f04
Otherwise forkit tends to loop aggressively re-starting that for the
duration of the test wastefully.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ia1c684a5d995f54f29290c9631b1ee14266445d7
Simple example to re-instate previous unit test.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I26da1178bc897797a656eb5ae9f838d17cbaf75f
Centralize more logging functionality in Log.cpp, simplify and
wrap underlying logging APIs better.
Code is much more generic, and hides implementation details
much more thoroughly, while keeping the same API / wrappers.
To do this we have to sub-class Poco::Logger to get access to
its generic 'log' method instead of a mess of in-line wrappers,
this lets us avoid lots of code.
Change-Id: I541d3aef49f99ce582655c5102a0041bf84cd56a
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
In all WOPI cases this is overridden by CheckFileInfo etc. but for
legacy direct file:/// usage this state can still be seen from
unit tests it seems.
cf. commit 115b9cf2ab
dump_state() output:
Document broker sessions [1]
id: 001
name: ToClient-001
...
isWritable: false
isReadOnly: false
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I19792b1dfdb6f5126a4d119a4d001a06bc507fb7
Get the polarity of the check on whether we succeeded to spawn a
background save process right, so we don't spawn two saves
concurrently, and block input processing in the wrong place.
Also a few obvious sillies fixed, and some more assertions for
good measure; was not good:
[ kitbgsv_001_001 ] TRC ToMaster-002: Finished synchronous background saving ...| kit/ChildSession.cpp:882
[ kitbgsv_001_001 ] TRC ToMaster-002: saveDocumentBackground returns succesful start.| kit/ChildSession.cpp:887
[ kitbgsv_001_001 ] TRC Document - input processing now: disabled was enabled| kit/Kit.cpp:2095
[ kitbgsv_001_001 ] TRC ToMaster-002: uno command .uno:Save {... notify: true| kit/ChildSession.cpp:1944
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ie06a74a538bdd5038ca9c94b422f27cff9e4a82e
Potentially zombie / badly behaving kits should be taken down
by the kernel, and this lets us continue our cleanup by killing
just the parent process.
Change-Id: I1e81f41cded0c67b72622f8ed88602daf427238c
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Re-using an inherited file descriptor to /dev/urandom frees us
from problems with mount options including 'nodev' and removes a
capability from the set we need.
Change-Id: I70337e923f802d7efbd3159c11a4e39f6529b6e6
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
This should be inherited by forked children, and kept alive at all
times. If we have it already open everywhere, there seems little
benefit to the getrandom / getentropy system calls.
Change-Id: I5d58f7216c65febd161cbd78c24308d9192830ee
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
So watchdog won't fire for a stalling kit.
After a fork the child has only one thread, but a copy of the watchdog
object.
Stop the watchdog thread before fork, let the child discard its copy of
the watchdog that is now in a discardable state.
And allow it to create a new one on the next SocketPoll ctor.
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I7dc166dca3996401fbdc20cd7643f944662454c8
By tracking the thread-id, we can deliver a SIGUSR2 to the right
thread at the right time; this avoids perf polling our uninteresting
watchdog thread.
In that thread use Caolan's suitably obscure futimestat system-call,
so that we can record based on that to see only slow things:
perf record -e syscalls:sys_enter_futimesat -ag --call-graph dwarf,65528
Change-Id: Iad05d8589fdc9541a7d0599f63625d2cde5fdf89
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Should launch new children more quickly on child death,
as well as getting to a waitpid and cleaning the zombies
faster too.
Change-Id: I06c36f63ac7ff52c407f739f1ce10d5e680fb82f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Forkit forking children is done in response to socket messages,
and parent process death should kill us too.
In general if we are relying on a poll to spin to achieve
something, we have a performance bug; this should exacerbate them
to flush them out.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I60d1c3b3c2532bbd686a3d3cfdea10f2a541a19a
Reduce the uses of MOBILEAPP conditionals by using the isMobileApp
function.
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: If541307fbc457b342674cc560b6c53454f3904cf