LibWebView+UI: Raise the chrome process open file limit

The default limit (at least on Linux) causes us to run out of file
descriptors at around 15 tabs. Increase this limit to 8k. This is a
rather arbitrary number, but matches the limit set by Chrome.
This commit is contained in:
Timothy Flynn 2024-07-22 10:17:44 -04:00 committed by Andreas Kling
commit d58a8b5146
Notes: github-actions[bot] 2024-07-23 07:40:33 +00:00
4 changed files with 15 additions and 4 deletions

View file

@ -7,6 +7,7 @@
#include <AK/ByteString.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h>
#include <LibCore/System.h>
#include <LibIPC/ConnectionToServer.h>
#include <LibWebView/ChromeProcess.h>
@ -22,6 +23,14 @@ private:
UIProcessClient(NonnullOwnPtr<Core::LocalSocket>);
};
ErrorOr<ChromeProcess> ChromeProcess::create()
{
// Increase the open file limit, as the default limits on Linux cause us to run out of file descriptors with around 15 tabs open.
TRY(Core::System::set_resource_limits(RLIMIT_NOFILE, 8192));
return ChromeProcess {};
}
ErrorOr<ChromeProcess::ProcessDisposition> ChromeProcess::connect(Vector<ByteString> const& raw_urls, bool new_window)
{
static constexpr auto process_name = "Ladybird"sv;