Sloooooooow swarm lighting build startup fix

To start off, I want to be clear that this is not about a slow lighting build…it’s about the slowness of the lighting build startup process and what I did to fix it.

Now, I don’t do a lot of lighting builds so I can’t say whether this is new or not. What I can say is that this happens on my system on both 4.27.2 and 5.0.0. I’ve seen similar posts but none that were on the nose with describing the symptoms and what to do to solve it. My hope is that this does that for someone else experiencing the same problem…or better yet, someone out there has a “you’re an idiot, just toggle editor setting X and you could have solved this” response.

So, to set the stage, on a very basic setup…literally on a new blank project or a new “Basic” level…I would kick off a lighting build with “Build Lighting Only”. I would then be met with a pop-up that indicates the lighting is being built and the progress bar at 100%. Nothing had happened yet by the way, and the editor would be frozen. I could see the swarm agent kick off in my app icon panel. So there I would sit and sit and sit some more. Nearly 3 minutes later, I would see all the familiar pop-ups on the bottom right hand corner indicating that the light building process had begun. As fast as they began popping up, the lighting build is complete and the editor is free again. Feeling that this was a particularly egregious waste of time for such a simple lighting configuration…and fearing for my time in the future as my lighting gets more complex…I decided to dig a little to see what was going on.

As a start I opened up the swarm agent by double-clicking on the icon in app icon tray. Under Log Settings / Verbosity I set it to SuperVerbose and kicked off another build. Below is the first bit that came out…

Ok, so far so good. The editor was frozen as it was previously so I sat and stared at the log output attempting to watch water boil. Nearly 90 seconds later there was a flash of log output (all yellow indicating warnings/failures) and the log went blank. I checked back in the editor and it still said that lighting was being build (100% done btw :slight_smile: ) but the editor was still frozen. Checking back with the swarm agent there was new log output!!!

Seriously?! So I stared and stared and stared some more, convinced that if I looked away all the magic was going to fly by and I was going to miss something key. Thankfully that wasn’t the case. After roughly another 90 seconds the log began to spew messages and you could tell something was happening. At that moment, all the familiar things kicked up (the lighting exporting, the photon emitting, etc.) and all was right in the world. And just like that, the lighting build was complete and the editor un-frozen. Scrolling back through the logs, immediately following the last message on the screenshot above, there was a more definitive warning message regarding the fact that it couldn’t communicate with the swarm coordinator…essentially the attempt timed out and it began doing the build locally. The time between the previous message and the “couldn’t connect” message was yet another 90’ish seconds. Those two wait times combined accounted for the 3’ish minutes I was waiting.

Ok, so before you ask, no, I was an idiot and did not save a screenshot this time. In my defense, I was too busy diagnosing and rebuilding to think about it and by time I got it all working I didn’t want to revert back to get the snapshot…I know, sad panda. Guilty feelings aside, I took notice of the fact that the swarm agent was attempting to connect to a swarm coordinator on RENDER-01…who is that anyway? I certainly don’t have an actual distributed build system and I also did not configure anything with RENDER-01. A bit of digging and searching through the forums I found one ray of hope here ("Failed to Connect to Swarm"). It’s an old post and the OP mentions similar symptoms but the resolution proposed did not work. It was a follow-up response which took me to down the right path which was to change the Distribution Settings / CoordinatorRemotingHost under the settings tab from RENDER-01 to localhost. I did so and kicked off the lighting build again but was met with the same resistance. Essentially it eventually failed out saying it couldn’t connect with the swarm coordinator (albeit on localhost this time), and proceeds to do the build itself. Following the bread crumbs I found the swarm coordinator under UE_5.0/Engine/Binaries/DotNET as SwarmCoordinator.exe. I fired it up, stared at it for a few seconds then I noticed a swarm agent register and pop-up in the coordinator’s list of agents.

I checked the swarm agent’s logs and sure enough, it reported that it was communicating with the coordinator…holding my breath I started the lighting build again and literally jumped out of my chair when the lighting build kicked off instantly. Before I could sit back down the lighting building had completed. For giggles, I killed the coordinator and started the lighting build again…and for 3 minutes I sat waiting for it to complete…of which I enjoyed every second :-).

Like I said in the beginning…I don’t know if this is new, old or something that is just effecting me. With any luck this will help someone who has the same issue in the future and , even better, illicit a response that removes the need to run a coordinator. While I’m happy to have this thing up and running I just find it odd that I even had to think about it. I would have figured that this is how it would all be configured by default…the again, this could be something specific to my setup and I’m just the odd man out.

Anyway, let me know if you have the same issue and this wasn’t enough detail to go off of to get you going…or if I’m totally off base and there’s an easier solution.