When trying to run a Unity build through the Terminal in our Jenkins build job, Unity is crashing with “Segmentation fault: 11”. This started happening when I tried to update our build process to use 2018.3.12f1, but it continued to happen after rolling back to 2018.3.3f1, which was previously working fine.
Details
Operating System: macOS Mojave (10.14.4)
Unity Version: 2018.3.12f1
I’ve reduced the command we use to launch unity to the following:
/Applications/Unity2018.3.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile -noUpm
When run manually in the terminal, this successfully loads the project, attempts to compile (and fails because packages are disabled), and then quits. When run through Jenkins from a remote machine, however, it produces the following output:
14:23:53 + /Applications/Unity2018.3.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile -noUpm
14:23:54 Initiating legacy licensing moduleDisplayProgressbar: Unity license
14:23:54
14:23:54 LICENSE SYSTEM [2019415 14:23:54] Next license update check is after 2019-04-16T14:33:17
14:23:54
14:23:54 /var/folders/nw/xf229xdj1mb9bjg8xgp19lqh0000gn/T/jenkins2051546300913103158.sh: line 2: 579 Segmentation fault: 11 /Applications/Unity2018.3.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile -noUpm
It appears that Unity is crashing with a segmentation fault before it’s even able to get started.
If I remove the “-noUpm” flag, I get the following additional error coming from the package manager:
14:39:27 + /Applications/Unity2018.3.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile
14:39:27 Initiating legacy licensing moduleDisplayProgressbar: Unity license
14:39:27
14:39:27 LICENSE SYSTEM [2019415 14:39:27] Next license update check is after 2019-04-16T14:33:17
14:39:27
14:39:27 [Package Manager] Server::Start -- Port 63746 was selected
14:39:27 Launching external process: /Applications/Unity2018.3.12f1/Unity.app/Contents/Resources/PackageManager/Server/UnityPackageManager
14:39:27 /var/folders/nw/xf229xdj1mb9bjg8xgp19lqh0000gn/T/jenkins274473516227971788.sh: line 2: 584 Segmentation fault: 11 /Applications/Unity2018.3.12f1/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -logFile
14:39:28 path.js:28
14:39:28 throw new TypeError('Path must be a string. Received ' + inspect(path));
14:39:28 ^
14:39:28
14:39:28 TypeError: Path must be a string. Received undefined
14:39:28 at assertPath (path.js:28:11)
14:39:28 at Object.join (path.js:1236:7)
14:39:28 at getLogFolder (/snapshot/upm/packages/server/diagnostics.js:0:0)
14:39:28 at enableDiagnostics (/snapshot/upm/packages/server/diagnostics.js:0:0)
14:39:28 at Object.<anonymous> (/snapshot/upm/packages/server/app.js:0:0)
14:39:28 at Module._compile (pkg/prelude/bootstrap.js:1252:22)
14:39:28 at Object.Module._extensions..js (module.js:661:10)
14:39:28 at Module.load (module.js:563:32)
14:39:28 at tryModuleLoad (module.js:503:12)
14:39:28 at Function.Module._load (module.js:495:3)
14:39:28 at Function.Module.runMain (pkg/prelude/bootstrap.js:1307:12)
14:39:28 at startup (bootstrap_node.js:227:16)
14:39:28 at bootstrap_node.js:648:3
While this issue appears to be related to how our build process is setup, it seems like there’s also a bug in Unity that’s causing it to crash, rather than provide a useful error message.
Additional Notes
- Our builds were originally succeeding on 2018.3.3f1, so I assumed the issue was specific to 2018.3.12f1. However, even after going back to 2018.3.3f1 the builds now fail with the same error message.
- Before each build, I clean the workspace and undo all modification, but leave the Library folder intact.
- If I manually connect to the build machine, open a terminal, and run the exact same command that’s being run by Jenkins, Unity is able to launch successfully and produces the expected output. Something about the Jenkins build environment is causing Unity to crash.
- Before running the first build that failed, I updated the operating system version to macOS 10.14.4 (I think it was previously on 10.14.3). Perhaps there’s something in the latest version of Mojave that’s causing Unity to crash?
Please let me know if there’s any other information I can provide. I appreciate any help anyone can offer!