I figured out what is going on last night. I rebuilt UE4.11.1 from source and started debugging it. After a lot of fooling around it became clear that the issue was the number of cores on the processor that the engine is running on. The cook always hung on a new basic project when running on a 2 core Intel core Duo, and always worked on a different machine with 4 cores and around the same processor vintage and memory.
I then tried using MSConfig to tell the 4 core machine it only had 2 cores, and then it hung on cook as well. I then patched the Windows NumCores and NumCoresIncludingHyperthreadsd functions to lie and say that the 2 core machine had 4 cores, and I was able to cook on the 2 core machine.
After more investigation I found the culprit, in the file Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp, in the function FEingineLoop::Preinit:
Here is the code:
#if WITH_EDITOR
// when we are in the editor we like to do things like build lighting and such
// this thread pool can be used for those purposes
GLargeThreadPool = FQueuedThreadPool::Allocate();
int32 NumThreadsInLargeThreadPool =
FPlatformMisc::NumberOfCoresIncludingHyperthreads() - 2;
verify(GLargeThreadPool->Create(NumThreadsInLargeThreadPool));
#endif
As you can see, if the number of cores including hyperthreads is 2 or less, no threads are created in the large thread pool. This causes one of the tasks involved in cooking to never finish. I added two lines:
if (NumThreadsInLargeThreadPool < 1)
NumThreadsInLargeThreadPool = 1;
After this addition my two core machine cooks fine (although it is slow).
I have pushed these changes to my forked repository, and am going to do a pull request. I also found another problem that prevented the CookOnTheFly.cpp file from compiling if you set the DEBUG_COOKONTHEFLY flag to 1.
Thanks,
Max Behensky