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 mythe amount of Windows Desktop Heap Sizeavailable to services, as opposed to applications, was too small. I worked around it by increasing the Windows Desktop Heap Sizesize 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 ).