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

Originator:pat
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.

Observations:
- 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:
https://github.com/descriptinc/electron-spawn-perf-bug

This repo is available as a pre-built sample app here:
https://github.com/descriptinc/electron-spawn-perf-bug/releases/tag/1.0.0



# Environment
Tested on Electron Versions:
10.1.3
10.1.4
11.0.0-beta.13
11.0.0-beta.17

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?

Comments


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!