--- Source/WebKit/Platform/IPC/unix/IPCUtilitiesUnix.cpp.orig +++ Source/WebKit/Platform/IPC/unix/IPCUtilitiesUnix.cpp @@ -34,6 +34,18 @@ SocketPair createPlatformConnection(int socketType, unsigned options) { std::array sockets; + +#if OS(DARWIN) + // macOS has a very small default buffer for AF_UNIX SOCK_DGRAM (2KB). + // WebKit IPC messages can be up to 4KB, so increase the buffer size. + socketType = SOCK_DGRAM; + RELEASE_ASSERT(socketpair(AF_UNIX, socketType, 0, sockets.data()) != -1); + constexpr int bufferSize = 262144; + setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); + setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); + setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); + setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); +#else #if OS(LINUX) if ((options & SetCloexecOnServer) || (options & SetCloexecOnClient)) { @@ -48,6 +60,7 @@ #endif RELEASE_ASSERT(socketpair(AF_UNIX, socketType, 0, sockets.data()) != -1); +#endif // OS(DARWIN) if (options & SetCloexecOnServer) RELEASE_ASSERT(setCloseOnExec(sockets[1]));