diff --git a/Ladybird/AppKit/main.mm b/Ladybird/AppKit/main.mm index dc59ff26f5b..6e50f0fcf6f 100644 --- a/Ladybird/AppKit/main.mm +++ b/Ladybird/AppKit/main.mm @@ -103,7 +103,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_option(allow_popups, "Disable popup blocking by default", "allow-popups"); args_parser.parse(arguments); - WebView::ChromeProcess chrome_process; + auto chrome_process = TRY(WebView::ChromeProcess::create()); if (!force_new_process && TRY(chrome_process.connect(raw_urls, new_window)) == WebView::ChromeProcess::ProcessDisposition::ExitProcess) { outln("Opening in existing process"); return 0; diff --git a/Ladybird/Qt/main.cpp b/Ladybird/Qt/main.cpp index 1254e25670a..9897cdbe30e 100644 --- a/Ladybird/Qt/main.cpp +++ b/Ladybird/Qt/main.cpp @@ -119,7 +119,7 @@ ErrorOr serenity_main(Main::Arguments arguments) args_parser.add_option(allow_popups, "Disable popup blocking by default", "allow-popups"); args_parser.parse(arguments); - WebView::ChromeProcess chrome_process; + auto chrome_process = TRY(WebView::ChromeProcess::create()); if (!force_new_process && TRY(chrome_process.connect(raw_urls, new_window)) == WebView::ChromeProcess::ProcessDisposition::ExitProcess) { outln("Opening in existing process"); return 0; diff --git a/Userland/Libraries/LibWebView/ChromeProcess.cpp b/Userland/Libraries/LibWebView/ChromeProcess.cpp index 1e94509e279..bcdcab5bafa 100644 --- a/Userland/Libraries/LibWebView/ChromeProcess.cpp +++ b/Userland/Libraries/LibWebView/ChromeProcess.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,14 @@ private: UIProcessClient(NonnullOwnPtr); }; +ErrorOr 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::connect(Vector const& raw_urls, bool new_window) { static constexpr auto process_name = "Ladybird"sv; diff --git a/Userland/Libraries/LibWebView/ChromeProcess.h b/Userland/Libraries/LibWebView/ChromeProcess.h index d6074f28b0b..fe469f0b561 100644 --- a/Userland/Libraries/LibWebView/ChromeProcess.h +++ b/Userland/Libraries/LibWebView/ChromeProcess.h @@ -40,7 +40,7 @@ private: class ChromeProcess { AK_MAKE_NONCOPYABLE(ChromeProcess); - AK_MAKE_NONMOVABLE(ChromeProcess); + AK_MAKE_DEFAULT_MOVABLE(ChromeProcess); public: enum class ProcessDisposition : u8 { @@ -48,7 +48,7 @@ public: ExitProcess, }; - ChromeProcess() = default; + static ErrorOr create(); ~ChromeProcess(); ErrorOr connect(Vector const& raw_urls, bool new_window); @@ -57,6 +57,8 @@ public: Function const& raw_urls)> on_new_window; private: + ChromeProcess() = default; + ErrorOr connect_as_client(ByteString const& socket_path, Vector const& raw_urls, bool new_window); ErrorOr connect_as_server(ByteString const& socket_path);