Electron apps: Spawning any child process takes significantly longer in Big Sur than it does in Catalina

Number:rdar://FB8885692 Date Originated:
Status: Resolved:
Product:macOS Product Version:Big Sur
Classification: Reproducible:
In the Electron framework, spawning any child process takes a significantly longer amount of time in Big Sur than it does in macOS 10.15 Catalina.

- The slowdown only happens on code signed apps.
- The slowdown only happens when spawning the child process from Electron's "renderer" process. Spawning from the "main" process is much faster (although still seemingly slower than on Catalina).

# To Reproduce
A sample repo demonstrating spawning the "ls" child process is available here:

This repo is available as a pre-built sample app here:

# Environment
Tested on Electron Versions:

Tested on Operating Systems:
macOS 11.0 Beta (20A5395g)
macOS 11.0.1 Beta (20B5022a)

This issue is not present in any Electron version on macOS 10.15 Catalina.

# Expected Behavior
If I call require('child_process').spawn('ls', ['.']), it should return quickly (<10ms).

Measurable with:

const { spawn } = require('child_process');
const start = Date.now();
spawn('ls', ['.']);
console.log(`spawn sync time: ${Date.now() - start}`);
Actual Behavior

# Actual Behavior
If run in a renderer process with nodeIntegration: true, it takes 300+ ms. When used with ffmpeg (our real-world case), we're seeing it go as long as 2-3 seconds, which leads me to think it's related to the binary size/code signing?


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!