4.16 Dedicated server game runs in editor window but crashes when editor tries to open new window

I just upgraded from 4.15 to 4.16. When I launch the game with dedicated server running, and one client in Play->Selected Viewport everything works fine. But if I try dedicated server and Play->Standalone, or if I try more then 1 player, each instance of newly opened window crashes immediately after showing skybox with this error:

Access violation - code c0000005 (first/second chance not available)

UE4Editor_D3D11RHI!FD3D11DynamicRHI::RHITransitionResources() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\windows\d3d11rhi\private\d3d11commands.cpp:2003]
UE4Editor_RHI!FRHICommandTransitionUAVs<0>::Execute() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\public\rhicommandlistcommandexecutes.inl:444]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteInner_DoExecute() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:248]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteInner() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:468]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteList() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:489]
UE4Editor_RHI!FRHICommandListBase::~FRHICommandListBase() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:707]
UE4Editor_RHI!FRHICommandWaitForAndSubmitSubList::Execute() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:893]
UE4Editor_RHI!FRHICommand::ExecuteAndDestruct() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\public\rhicommandlist.h:366]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteInner_DoExecute() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:248]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteInner() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:468]
UE4Editor_RHI!FRHICommandListExecutor::ExecuteList() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:516]
UE4Editor_RHI!FDynamicRHI::LockVertexBuffer_RenderThread() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\private\rhicommandlist.cpp:1864]
UE4Editor_Renderer!FDynamicReadBuffer::Lock() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\public\rhiutilities.h:192]
UE4Editor_Renderer!FDeferredShadingSceneRenderer::ComputeLightGrid() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\renderer\private\lightgridinjection.cpp:566]
UE4Editor_Renderer!FDeferredShadingSceneRenderer::Render() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\renderer\private\deferredshadingrenderer.cpp:823]
UE4Editor_Renderer!RenderViewFamily_RenderThread() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\renderer\private\scenerendering.cpp:1821]
UE4Editor_Renderer!TGraphTask<FRendererModule::BeginRenderingViewFamily'::26’::EURCMacro_FDrawSceneCommand>::ExecuteTask() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\public\async\taskgraphinterfaces.h:883]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:954]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\async\taskgraph.cpp:701]
UE4Editor_RenderCore!RenderingThreadMain() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:327]
UE4Editor_RenderCore!FRenderingThread::Run() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rendercore\private\renderingthread.cpp:461]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:76]

After a few hours of googling and researching and I don’t see anyone else having this problem. So I would appreciate it if someone could tell me where to start looking.

First I thought the new engine doesn’t package my project anymore - I was wrong. It does. And it runs, but crashes right after creating the game window with:
Fatal error: [File:D:\Build++UE4+Release-4.16+Compile\Sync\Engine\Source\Runtime\RenderCore\Private\RenderingThread.cpp] [Line: 798]
Rendering thread exception:
Fatal error!
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0xffffffff

Then I thought, well maybe it’s nVidia’s drivers, so I updated those and still no change.

So I upgraded ContentExamples project from 4.14 to 4.16 and ran that with dedicated server and 2 players - that didn’t crash.

So now I think I’m going to download the source for the engine, try running the project from source and debug this error, but before I do I was wondering if there’s an easier way to debug this, or if anyone else was having this issue and found a solution.

EDIT: I forgot to post the log printout from the crash.

LogThreadingWindows:Error: Runnable thread RenderThread 1 crashed.
LogWindows:Error: === Critical error: ===
LogWindows:Error:
LogWindows:Error: Assertion failed: !DrawUPData.OutVertexData && !DrawUPData.OutIndexData [File:d:\build++ue4+release-4.16+compile\sync\engine\source\runtime\rhi\public\RHICommandList.inl] [Line: 20]
LogWindows:Error:
LogWindows:Error:
LogWindows:Error:
LogWindows:Error:
LogWindows:Error: Crash in runnable thread RenderThread 1

Hello!
Maybe I can help You.
I’ve got the same problem with my project when migrate from 4.15 to 4.16. In my case I fix this problem by upgrading of *.Build.cs and *.Target.cs files to new syntax. The easiest way to find out what to change is to create new project and look into thise files in new project.

To build and run dedicated server your’s *.Build.cs file should look like this:

public class YourGame : ModuleRules
    {
    	public YourGame(ReadOnlyTargetRules Target) : base(Target)
    	{
            PublicDependencyModuleNames.AddRange(new string[] { 
                "Core", 
                "CoreUObject", 
                "Engine", 
                ...
            });
        }
    }

And *Server.Target.cs should looks like this:

public class YourGameServerTarget : TargetRules
    {
        public YourGameServerTarget(TargetInfo Target) : base(Target)
        {
            Type = TargetType.Server;
            ExtraModuleNames.Add("YourGame");
        }
    }

I did this. Without this the project won’t compile. The problem I’m having is a runtime error, not compile error.

I am having this same problem, I was having a discussion with NFMynster on Discord (Discord) and it was mentioned it could be because of a map issue, it seems you need to specify your maps in the cook packaging

which could be in turn be because of this bugfix coming in 4.16.2

https://github.com/EpicGames/UnrealEngine/commit/b891dcd4e208b911a4887bcda2b48f35a845b05b

I’m guessing atm tho, I will report back if this fixes me issue.

I figured out my issue personally, in updating my target.cs I had to add this attribute

[SupportedPlatforms(UnrealPlatformClass.Server)]

so i downloaded shooter game and inspected how they setup their build/target - for future issues this is a good approach

// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.

using UnrealBuildTool;
using System.Collections.Generic;

[SupportedPlatforms(UnrealPlatformClass.Server)]
public class ShooterGameServerTarget : TargetRules
{
	public ShooterGameServerTarget(TargetInfo Target) : base(Target)
	{
		Type = TargetType.Server;
		bUsesSteam = true;

		ExtraModuleNames.Add("ShooterGame");
	}
}