mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibIPC: Chunk sent file descriptors by MAX_TRANSFER_FDS
Some checks failed
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Has been cancelled
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Has been cancelled
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Has been cancelled
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Has been cancelled
Build Dev Container Image / build (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Has been cancelled
Run test262 and test-wasm / run_and_update_results (push) Has been cancelled
Lint Code / lint (push) Has been cancelled
Label PRs with merge conflicts / auto-labeler (push) Has been cancelled
Push notes / build (push) Has been cancelled
Some checks failed
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Has been cancelled
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Has been cancelled
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Has been cancelled
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Has been cancelled
Build Dev Container Image / build (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Has been cancelled
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Has been cancelled
Run test262 and test-wasm / run_and_update_results (push) Has been cancelled
Lint Code / lint (push) Has been cancelled
Label PRs with merge conflicts / auto-labeler (push) Has been cancelled
Push notes / build (push) Has been cancelled
This limitation of the underlying Unix socket implementation can cause IPC failures on pages with tons of images and network requests. Modify the code called from TransportSocket's send thread to limit the number of fds to MAX_TRANSFER_FDS, and ensure that we will keep sending as long as we have either bytes or file descriptors to send.
This commit is contained in:
parent
87fbfcadd1
commit
8095663f86
Notes:
github-actions[bot]
2025-05-24 16:16:03 +00:00
Author: https://github.com/ADKaster
Commit: 8095663f86
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4848
Reviewed-by: https://github.com/kalenikaliaksandr ✅
1 changed files with 7 additions and 2 deletions
|
@ -46,7 +46,12 @@ SendQueue::BytesAndFds SendQueue::peek(size_t max_bytes)
|
|||
auto bytes_to_send = min(max_bytes, m_stream.used_buffer_size());
|
||||
result.bytes.resize(bytes_to_send);
|
||||
m_stream.peek_some(result.bytes);
|
||||
result.fds = m_fds;
|
||||
|
||||
if (m_fds.size() > 0) {
|
||||
auto fds_to_send = min(m_fds.size(), Core::LocalSocket::MAX_TRANSFER_FDS);
|
||||
result.fds = Vector<int> { m_fds.span().slice(0, fds_to_send) };
|
||||
// NOTE: This relies on a subsequent call to discard to actually remove the fds from m_fds
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -287,7 +292,7 @@ TransportSocket::ShouldShutdown TransportSocket::read_as_many_messages_as_possib
|
|||
}
|
||||
|
||||
auto bytes_read = maybe_bytes_read.release_value();
|
||||
if (bytes_read.is_empty()) {
|
||||
if (bytes_read.is_empty() && received_fds.is_empty()) {
|
||||
should_shutdown = true;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue