wsd: debug: run the server with a single "lokit" process
Sometimes it is very useful to have one "lokit" process, to focus on a 100% reproducible bug, and not worry that server pre-spawn several processes. Change-Id: I414a8145b53a0601a282cba9c245833f5d07f404 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89999 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Henry Castro <hcastro@collabora.com>distro/collabora/co-4-2-1
parent
9d412a164e
commit
7ba4e9dd23
19
Makefile.am
19
Makefile.am
|
@ -331,6 +331,25 @@ run: all @JAILS_PATH@
|
|||
--o:admin_console.username=admin --o:admin_console.password=admin \
|
||||
--o:logging.file[@enable]=true --o:logging.level=trace
|
||||
|
||||
if ENABLE_DEBUG
|
||||
run-one: all @JAILS_PATH@
|
||||
@echo "Launching loolwsd"
|
||||
@fc-cache "@LO_PATH@"/share/fonts/truetype
|
||||
@cp $(abs_top_srcdir)/test/data/hello.odt $(abs_top_srcdir)/test/data/hello-world.odt
|
||||
@cp $(abs_top_srcdir)/test/data/hello.ods $(abs_top_srcdir)/test/data/hello-world.ods
|
||||
@cp $(abs_top_srcdir)/test/data/hello.odp $(abs_top_srcdir)/test/data/hello-world.odp
|
||||
@echo
|
||||
./loolwsd --o:sys_template_path="@SYSTEMPLATE_PATH@" \
|
||||
--o:security.capabilities="$(CAPABILITIES)" \
|
||||
--o:child_root_path="@JAILS_PATH@" --o:storage.filesystem[@allow]=true \
|
||||
--o:ssl.cert_file_path="$(abs_top_srcdir)/etc/cert.pem" \
|
||||
--o:ssl.key_file_path="$(abs_top_srcdir)/etc/key.pem" \
|
||||
--o:ssl.ca_file_path="$(abs_top_srcdir)/etc/ca-chain.cert.pem" \
|
||||
--o:admin_console.username=admin --o:admin_console.password=admin \
|
||||
--o:logging.file[@enable]=true --o:logging.level=trace \
|
||||
--singlekit
|
||||
endif
|
||||
|
||||
sync-writer:
|
||||
browser-sync start --config browsersync-config.js --startPath "loleaflet/96c23f663/loleaflet.html?file_path=file://$(abs_top_srcdir)/test/data/hello-world.odt"
|
||||
|
||||
|
|
|
@ -47,7 +47,11 @@ using Poco::Thread;
|
|||
#ifndef KIT_IN_PROCESS
|
||||
static bool NoCapsForKit = false;
|
||||
static bool NoSeccomp = false;
|
||||
#if ENABLE_DEBUG
|
||||
static bool SingleKit = false;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static bool DisplayVersion = false;
|
||||
static std::string UnitTestLibrary;
|
||||
static std::string LogLevel;
|
||||
|
@ -462,6 +466,10 @@ int main(int argc, char** argv)
|
|||
eq = std::strchr(cmd, '=');
|
||||
UnitTestLibrary = std::string(eq+1);
|
||||
}
|
||||
else if (std::strstr(cmd, "--singlekit") == cmd)
|
||||
{
|
||||
SingleKit = true;
|
||||
}
|
||||
#endif
|
||||
// we are running in a lower-privilege mode - with no chroot
|
||||
else if (std::strstr(cmd, "--nocaps") == cmd)
|
||||
|
@ -550,6 +558,9 @@ int main(int argc, char** argv)
|
|||
break;
|
||||
}
|
||||
|
||||
#if ENABLE_DEBUG
|
||||
if (!SingleKit)
|
||||
#endif
|
||||
forkLibreOfficeKit(childRoot, sysTemplate, loTemplate, loSubPath);
|
||||
}
|
||||
|
||||
|
|
|
@ -356,6 +356,13 @@ void cleanupDocBrokers()
|
|||
|
||||
LOG_END(logger, true);
|
||||
}
|
||||
|
||||
#if ENABLE_DEBUG
|
||||
if (LOOLWSD::SingleKit && DocBrokers.size() == 0)
|
||||
{
|
||||
SigUtil::requestShutdown();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -702,6 +709,9 @@ std::atomic<int> LOOLWSD::ForKitProcId(-1);
|
|||
bool LOOLWSD::NoCapsForKit = false;
|
||||
bool LOOLWSD::NoSeccomp = false;
|
||||
bool LOOLWSD::AdminEnabled = true;
|
||||
#if ENABLE_DEBUG
|
||||
bool LOOLWSD::SingleKit = false;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef FUZZER
|
||||
bool LOOLWSD::DummyLOK = false;
|
||||
|
@ -1361,6 +1371,10 @@ void LOOLWSD::defineOptions(OptionSet& optionSet)
|
|||
.required(false)
|
||||
.repeatable(false)
|
||||
.argument("seconds"));
|
||||
|
||||
optionSet.addOption(Option("singlekit", "", "Spawn one libreoffice kit.")
|
||||
.required(false)
|
||||
.repeatable(false));
|
||||
#endif
|
||||
|
||||
#ifdef FUZZER
|
||||
|
@ -1408,6 +1422,11 @@ void LOOLWSD::handleOption(const std::string& optionName,
|
|||
UnitTestLibrary = value;
|
||||
else if (optionName == "careerspan")
|
||||
careerSpanMs = std::stoi(value) * 1000; // Convert second to ms
|
||||
else if (optionName == "singlekit")
|
||||
{
|
||||
SingleKit = true;
|
||||
NumPreSpawnedChildren = 1;
|
||||
}
|
||||
|
||||
static const char* latencyMs = std::getenv("LOOL_DELAY_SOCKET_MS");
|
||||
if (latencyMs)
|
||||
|
@ -1560,6 +1579,7 @@ void PrisonerPoll::wakeupHook()
|
|||
LOG_TRC("PrisonerPoll - wakes up with " << NewChildren.size() <<
|
||||
" new children and " << DocBrokers.size() << " brokers and " <<
|
||||
OutstandingForks << " kits forking");
|
||||
|
||||
if (!LOOLWSD::checkAndRestoreForKit())
|
||||
{
|
||||
// No children have died.
|
||||
|
@ -1644,6 +1664,11 @@ bool LOOLWSD::createForKit()
|
|||
if (NoSeccomp)
|
||||
args.push_back("--noseccomp");
|
||||
|
||||
#if ENABLE_DEBUG
|
||||
if (SingleKit)
|
||||
args.push_back("--singlekit");
|
||||
#endif
|
||||
|
||||
#ifdef STRACE_LOOLFORKIT
|
||||
std::string forKitPath = "strace";
|
||||
#else
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
static bool NoCapsForKit;
|
||||
static bool NoSeccomp;
|
||||
static bool AdminEnabled;
|
||||
#if ENABLE_DEBUG
|
||||
static bool SingleKit;
|
||||
#endif
|
||||
#endif
|
||||
static std::atomic<int> ForKitWritePipe;
|
||||
static std::atomic<int> ForKitProcId;
|
||||
|
|
Loading…
Reference in New Issue