When running a jenkins build using the Unity 3D plugin I get the following error repeatedly:

Failed to get socket connection from UnityShaderCompiler.exe shader compiler! C:/Program Files/Unity/Editor/Data/Tools/UnityShaderCompiler.exe


Not sure what's going on there, I tried giving a pass to the exe in windows firewall but it didn't help.

I have Unity 2017.1 installed...

Don't run the Jenkins agent using Windows Services. Instead, launch the agent manually using CLI.

This seems to be a bug with Unity, I've been unsuccessfully trying to create a small repro case that I could submit to Unity.

I also encountered this problem. For me it happened when I was running multiple Unity instances at once on a single Jenkins node what the Jenkins agent was running as Windows Service.

The problem turned out to be that the amount of Windows Desktop Heap available to services, as opposed to applications, was too small. I worked around it by increasing the Windows Desktop Heap size for services on my node, following the advice here -- https://stackoverflow.com/questions/17472389/how-to-increase-the-maximum-number-of-child-processes-that-can-be-spawned-by-a-w/17472390#17472390 (which I found here -- https://answers.unity.com/questions/1430683/failed-to-get-socket-connection-from-unityshaderco-2.html ).

• It's not clear whether you're answering the question or if you're still having the issue. If you're providing a solution, could you add the core of what those links are suggesting? While pointed content is useful, links may rot, making this answer irrelevant for future visitors. – Vaillancourt Apr 18 '19 at 1:03
• Did my changes improve the answer? Increasing the Windows Desktop Heap Size is a reasonably involved process involving registry changes, and pasting just the pertinent snippets without the broader context didn't seem like a good idea, whereas providing a through introduction to the topic seemed out of scope in the context of the question here. – Yossi Horowitz Apr 23 '19 at 1:15
• Yes, thanks a lot for the update! – Vaillancourt Apr 23 '19 at 1:27

Another condition for this error message occurring repeatedly is when multiple Unity builds are running at the same time on Jenkins.

One possible workaround solution for this is to reduce the # of executors in Jenkins to 1 (from 2 in my case) so that only 1 Unity build can occur at a time.

Notes

• I have Unity 2017.3 installed, and I did not have this issue with Unity 5.6.
• To find the option, see Manage Jenkins -> Configure System -> # of executors in the Jenkins interface.)

Here is the error message with stack trace

Failed to get socket connection from UnityShaderCompiler.exe shader compiler! C:/Program Files/Unity/Editor/Data/Tools/UnityShaderCompiler.exe
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:337)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:234)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at C:\buildslave\unity\build\artifacts\generated\common\editor\BuildPipelineBindings.gen.cs:212)
[+ call stack from my build script]