C++ Difference between PIE and Packed Game

Hi there,

I have a project (c++) and in PIE everything looks good. The objects get created as I press play and as far as I can see all function calls are correct. As I package the project I get a fatal error directly after clicking the exe and the logfile looks strange. Multiple objects have their constructors called more than once so I believe that this might be the problem but I can’t figure out why this happens.

I’ve tried to build on Win7 64Bit and Win10 64Bit using. The build in VS ends with no errors and the packaging from the editor also states successful.

The logfiles are attached and the source can be downloaded here: Dropbox - Error - Simplify your life

In the logs the relevant custom classes begin with DB (e.g. DBGameInstance).

PIE-Log:


[2015.08.17-12.02.52:141] 89]LogPlayLevel: PIE:  No blueprints needed recompiling
[2015.08.17-12.02.52:141] 89]PIE: New page: PIE session: LoginMap (Aug 17, 2015, 4:02:52 PM)
[2015.08.17-12.02.52:142] 89]LogPlayLevel: Creating play world package: /Game/Maps/UEDPIE_0_LoginMap
[2015.08.17-12.02.52:144] 89]LogPlayLevel: PIE: StaticDuplicateObject took: (0.001880s)
[2015.08.17-12.02.52:145] 89]LogAIModule: Creating AISystem for world LoginMap
[2015.08.17-12.02.52:150] 89]LogPlayLevel: PIE: World Init took: (0.006100s)
[2015.08.17-12.02.52:151] 89]LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/Maps/LoginMap.LoginMap to /Game/Maps/UEDPIE_0_LoginMap.LoginMap (0.008500s)
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBGameInstance: Init called.
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBNetworkClient: Constructor called.
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBGameInstance: PhotonClient created.
[2015.08.17-12.02.52:186] 89]DBNet:Warning: DBNetworkClient: PhotonPeer connect called.
[2015.08.17-12.02.52:188] 89]LogInit: XAudio2 using 'Speaker/HP (Realtek High Definition Audio)' : 2 channels at 48 kHz using 32 bits per sample (channel mask 0x3)
[2015.08.17-12.02.52:196] 89]LogInit: FAudioDevice initialized.
[2015.08.17-12.02.52:230] 89]LogWorld: Game class is 'DBGameMode'
[2015.08.17-12.02.52:233] 89]LogWorld: Bringing World /Game/Maps/UEDPIE_0_LoginMap.LoginMap up for play (max tick rate 60) at 2015.08.17-14.02.52
[2015.08.17-12.02.52:233] 89]DB:Warning: ==========================================
[2015.08.17-12.02.52:233] 89]DB:Warning:   Init Game Option: 
[2015.08.17-12.02.52:233] 89]DB:Warning:   Init Game Map: UEDPIE_0_LoginMap
[2015.08.17-12.02.52:233] 89]DB:Warning:   Init Game Error: 
[2015.08.17-12.02.52:233] 89]LogActor:Warning: GameSession /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.GameSession_5 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2015.08.17-12.02.52:234] 89]LogActor:Warning: GameNetworkManager /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.GameNetworkManager_5 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2015.08.17-12.02.52:234] 89]LogWorld: Bringing up level for play took: 0.001802
[2015.08.17-12.02.52:235] 89]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.17-12.02.52:235] 89]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.17-12.02.52:235] 89]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.17-12.02.52:235] 89]DBNet: DBLoginHandler: OwningGameInstance: DBGameInstance_16.
[2015.08.17-12.02.52:235] 89]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: LoginHandler.
[2015.08.17-12.02.52:235] 89]DBNet: DBNetworkListener: Handler got: LoginHandler.
[2015.08.17-12.02.52:236] 89]DBNet:Warning: DBLoginController: BeginPlay()
[2015.08.17-12.02.52:236] 89]DBNet:Warning: DBLoginController: GameInstance set to DBGameInstance_16.
[2015.08.17-12.02.52:236] 89]PIE: Info Play in editor start time for /Game/Maps/UEDPIE_0_LoginMap -0.865
[2015.08.17-12.02.52:236] 89]DBNet: DBGameInstance: Service called.
[2015.08.17-12.02.52:253] 90]DBNet: DBGameInstance: Service called.
[2015.08.17-12.02.52:270] 91]DBNet: DBGameInstance: Service called.

Packaged Game Log:


[2015.08.17-11.58.11:263]  0]LogD3D11RHI: Found D3D11 adapter 0: Intel(R) HD Graphics 4600 (Feature Level 11_0)
[2015.08.17-11.58.11:263]  0]LogD3D11RHI: Adapter has 64MB of dedicated video memory, 0MB of dedicated system memory, and 1632MB of shared system memory, 3 output[s]
[2015.08.17-11.58.11:263]  0]LogD3D11RHI: Chosen D3D11 Adapter Id = 0
[2015.08.17-11.58.11:269]  0]LogD3D11RHI: InitD3DDevice
[2015.08.17-11.58.11:269]  0]LogD3D11RHI: !Direct3DDevice
[2015.08.17-11.58.11:269]  0]LogRHI: Texture pool is 616 MB (70% of 880 MB)
[2015.08.17-11.58.11:278]  0]LogD3D11RHI: Async texture creation enabled
[2015.08.17-11.58.11:379]  0]DBNet:Warning: DBNetworkClient: Constructor called.
[2015.08.17-11.58.11:379]  0]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.17-11.58.11:379]  0]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.17-11.58.11:381]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.17-11.58.11:397]  0]LogModuleManager:Warning: ModuleManager: Module 'ExampleDeviceProfileSelector' not found - its StaticallyLinkedModuleInitializers function is null.
[2015.08.17-11.58.11:495]  0]LogInit: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
[2015.08.17-11.58.11:658]  0]LogD3D11RHI: InitD3DDevice
[2015.08.17-11.58.12:159]  0]LogObj: 21065 objects as part of root set at end of initial load.
.........
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBGameInstance: Init called.
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBNetworkClient: Constructor called.
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBGameInstance: PhotonClient created.
[2015.08.17-11.58.12:482]  0]DBNet:Warning: DBNetworkClient: PhotonPeer connect called.
[2015.08.17-11.58.12:503]  0]LogNet: Browse: /Game/Maps/LoginMap?Name=Player
[2015.08.17-11.58.12:503]  0]LogLoad: LoadMap: /Game/Maps/LoginMap?Name=Player
.........
[2015.08.17-11.58.12:547]  0]LogAIModule: Creating AISystem for world LoginMap
[2015.08.17-11.58.12:547]  0]LogWorld: Game class is 'DBGameMode'
[2015.08.17-11.58.12:549]  0]LogWorld: Bringing World /Game/Maps/LoginMap.LoginMap up for play (max tick rate 0) at 2015.08.17-13.58.12
[2015.08.17-11.58.12:549]  0]DB:Warning: ==========================================
[2015.08.17-11.58.12:549]  0]DB:Warning:   Init Game Option: ?Name=Player
[2015.08.17-11.58.12:549]  0]DB:Warning:   Init Game Map: LoginMap
[2015.08.17-11.58.12:549]  0]DB:Warning:   Init Game Error: 
[2015.08.17-11.58.12:549]  0]LogWorld: Bringing up level for play took: 0.000529
[2015.08.17-11.58.12:551]  0]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.17-11.58.12:551]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.17-11.58.12:551]  0]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.17-11.58.12:551]  0]DBNet: DBLoginHandler: OwningGameInstance: DBGameInstance_0.
[2015.08.17-11.58.12:551]  0]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: LoginHandler.
[2015.08.17-11.58.12:551]  0]DBNet: DBNetworkListener: Handler got: LoginHandler.
[2015.08.17-11.58.16:245]  0]LogWindows:Warning: CreateProc failed (2) ..\..\..\Engine\Binaries/Win64/CrashReportClient.exe  -AppName=UE4-DragonBorn
[2015.08.17-11.58.16:245]  0]LogWindows: Could not start CrashReportClient.exe
[2015.08.17-11.58.16:245]  0]LogMemory: Platform Memory Stats for WindowsNoEditor
[2015.08.17-11.58.16:245]  0]LogMemory: Process Physical Memory: 187.61 MB used, 187.68 MB peak
[2015.08.17-11.58.16:245]  0]LogMemory: Process Virtual Memory: 189.61 MB used, 263.84 MB peak
[2015.08.17-11.58.16:245]  0]LogMemory: Physical Memory: 5293.25 MB used, 7912.56 MB total
[2015.08.17-11.58.16:245]  0]LogMemory: Virtual Memory: 566.52 MB used, 8388608.00 MB total
[2015.08.17-11.58.34:810]  0]LogWindows: === Critical error: ===
Fatal error!



DragonBorn-Win64-DebugGame.exe!DBNetworkListener::setCurrentHandler() {0x000000013f25dfc2} + 16 bytes [c:	emp\dragonborn\source\dragonborn\private
etwork\dbnetwor
DragonBorn-Win64-DebugGame.exe!UDBNetworkClient::PhotonSetCurrentHandler() {0x000000013f25d8dc} + 25 bytes [c:	emp\dragonborn\source\dragonborn\private
etwork\dbnetwor
DragonBorn-Win64-DebugGame.exe!UDBLoginHandler::InitializeComponent() {0x000000013f25bee5} + 0 bytes [c:	emp\dragonborn\source\dragonborn\private\loginsystem\dblo
DragonBorn-Win64-DebugGame.exe!AActor::InitializeComponents() {0x000000013f9c6b29} + 0 bytes
DragonBorn-Win64-DebugGame.exe!AActor::PostActorConstruction() {0x000000013f9cbc84} + 0 bytes
DragonBorn-Win64-DebugGame.exe!AActor::FinishSpawning() {0x000000013f9b5d80} + 0 bytes
DragonBorn-Win64-DebugGame.exe!AActor::PostSpawnInitialize() {0x000000013f9cca89} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UWorld::SpawnActor() {0x000000013fa3d080} + 0 bytes
DragonBorn-Win64-DebugGame.exe!ADBGameMode::BeginPlay() {0x000000013f257da0} + 69 bytes [c:	emp\dragonborn\source\dragonborn\private\dbgamemode.cpp:3
DragonBorn-Win64-DebugGame.exe!AWorldSettings::NotifyBeginPlay() {0x00000001400f4afd} + 0 bytes
DragonBorn-Win64-DebugGame.exe!AGameMode::HandleMatchHasStarted() {0x000000013f88adf2} + 0 bytes
DragonBorn-Win64-DebugGame.exe!AGameMode::SetMatchState() {0x000000013f8aacd0} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UWorld::BeginPlay() {0x00000001400d080e} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UEngine::LoadMap() {0x000000013f94e9e8} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UEngine::Browse() {0x000000013f8f5e8e} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UGameInstance::StartGameInstance() {0x000000013f8ae793} + 0 bytes
DragonBorn-Win64-DebugGame.exe!UGameEngine::Init() {0x000000013f88cb6b} + 0 bytes
DragonBorn-Win64-DebugGame.exe!FEngineLoop::Init() {0x000000013f29bab5} + 0 bytes
DragonBorn-Win64-DebugGame.exe!GuardedMain() {0x000000013f29ae78} + 0 bytes
DragonBorn-Win64-DebugGame.exe!GuardedMainWrapper() {0x000000013f29b1aa} + 0 bytes
DragonBorn-Win64-DebugGame.exe!WinMain() {0x000000013f2ada19} + 0 bytes
DragonBorn-Win64-DebugGame.exe!__tmainCRTStartup() {0x000000014214d815} + 21 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]
kernel32.dll {0x00000000778259cd} + 0 bytes
ntdll.dll {0x000000007795b981} + 0 bytes
ntdll.dll {0x000000007795b981} + 0 bytes

Hope someone can help me with this issue.

As this is related to GameInstance it looks like there could be a potential issue there.

GameInstances do behave a bit differently in PIE, since all PIE instances share the same GameInstance. In Standalone, they do of course all have their own. You can test each PIE instance with their own game instance by going into the advanced Play-In-Editor options and flipping the ‘Use Single Process’ option. Basically that will force all PIE instances to have their own GameInstance rather than rely on the shared one, but it also means your game will take longer to load up.

Try that first and if it crashes again, then you’ve found a problem in your game instance, or something related to it.

Unchecked Use Single Process and startet PIE - no crash. Startet as Stand Alone and crashed (use Single Process checked and unchecked).


[2015.08.17-12.47.21:980]  0]Log file open, 08/17/15 14:47:21
[2015.08.17-12.47.21:980]  0]LogInit:Display: Running engine for game: DragonBorn
[2015.08.17-12.47.21:980]  0]LogInit:Display: RandInit(2138437466) SRandInit(2138437466).
[2015.08.17-12.47.21:980]  0]LogTaskGraph: Started task graph with 4 named threads and 5 total threads.
[2015.08.17-12.47.21:980]  0]LogStats: Stats thread started
[2015.08.17-12.47.21:980]  0]LogInit: Version: 4.8.3-2634408+++depot+UE4-Releases+4.8
[2015.08.17-12.47.21:980]  0]LogInit: API Version: 2579680
[2015.08.17-12.47.21:980]  0]LogInit: Compiled (64-bit): Jul 27 2015 16:24:33
[2015.08.17-12.47.21:980]  0]LogInit: Compiled with Visual C++: 18.00.21005.01
[2015.08.17-12.47.21:980]  0]LogInit: Build Configuration: Development
[2015.08.17-12.47.21:980]  0]LogInit: Branch Name: ++depot+UE4-Releases+4.8
[2015.08.17-12.47.21:980]  0]LogInit: Command line:  /Temp/Autosaves/Game/Maps/UEDPCLoginMap -game -PIEVIACONSOLE -ResX=1280 -ResY=720  -Multiprocess 
[2015.08.17-12.47.21:980]  0]LogInit: Base directory: C:/Temp/Epic Games/4.8/Engine/Binaries/Win64/
[2015.08.17-12.47.21:980]  0]LogInit: Rocket: 1
[2015.08.17-12.47.22:057]  0]LogInit: Using libcurl 7.41.0
[2015.08.17-12.47.22:057]  0]LogInit:  - built for x86_64-pc-win32
[2015.08.17-12.47.22:057]  0]LogInit:  - supports SSL with WinSSL
[2015.08.17-12.47.22:057]  0]LogInit:  - other features:
[2015.08.17-12.47.22:057]  0]LogInit:      CURL_VERSION_SSL
[2015.08.17-12.47.22:057]  0]LogInit:      CURL_VERSION_IPV6
[2015.08.17-12.47.22:057]  0]LogInit:      CURL_VERSION_ASYNCHDNS
[2015.08.17-12.47.22:057]  0]LogInit:      CURL_VERSION_LARGEFILE
[2015.08.17-12.47.22:057]  0]LogInit:      CURL_VERSION_IDN
[2015.08.17-12.47.22:057]  0]LogInit:  CurlRequestOptions (configurable via config and command line):
[2015.08.17-12.47.22:057]  0]LogInit:  - bVerifyPeer = true  - Libcurl will verify peer certificate
[2015.08.17-12.47.22:057]  0]LogInit:  - bUseHttpProxy = false  - Libcurl will NOT use HTTP proxy
[2015.08.17-12.47.22:057]  0]LogInit:  - bDontReuseConnections = false  - Libcurl will reuse connections
[2015.08.17-12.47.22:057]  0]LogInit:  - CertBundlePath = nullptr  - Libcurl will use whatever was configured at build time.
[2015.08.17-12.47.22:134]  0]LogOnline:Warning: No default platform service specified for OnlineSubsystem
[2015.08.17-12.47.22:180]  0]LogInit: Presizing for 0 objects not considered by GC, pre-allocating 0 bytes.
[2015.08.17-12.47.22:213]  0]LogInit: Object subsystem initialized
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning: Skipping Unknown console variable: 'TranslucentSortAxis = (X=0.000000,Y=-1.000000,Z=0.000000)'
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning:   Found in ini file 'C:/Temp/DragonBorn/Saved/Config/Windows/Engine.ini', in section '[/Script/Engine.RendererSettings]'
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning: Skipping Unknown console variable: 'UIScaleRule = ShortestSide'
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning:   Found in ini file 'C:/Temp/DragonBorn/Saved/Config/Windows/Engine.ini', in section '[/Script/Engine.RendererSettings]'
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning: Skipping Unknown console variable: 'UIScaleCurve = (EditorCurveData=(Keys=),ExternalCurve=None)'
[2015.08.17-12.47.22:216]  0]LogConsoleResponse:Warning:   Found in ini file 'C:/Temp/DragonBorn/Saved/Config/Windows/Engine.ini', in section '[/Script/Engine.RendererSettings]'
[2015.08.17-12.47.22:258]  0]LogInit: Selected Device Profile: [Windows]
[2015.08.17-12.47.22:258]  0]LogInit: Applying CVar settings loaded from the selected device profile: [Windows]
[2015.08.17-12.47.22:267]  0]LogInit: Computer: DEGVNWN8685948
[2015.08.17-12.47.22:267]  0]LogInit: User: dhlhse2412
[2015.08.17-12.47.22:267]  0]LogInit: CPU Page size=4096, Cores=2
[2015.08.17-12.47.22:267]  0]LogInit: High frequency timer resolution =2.533261 MHz
[2015.08.17-12.47.22:267]  0]LogMemory: Memory total: Physical=7.7GB (8GB approx)
[2015.08.17-12.47.22:267]  0]LogMemory: Platform Memory Stats for Windows
[2015.08.17-12.47.22:267]  0]LogMemory: Process Physical Memory: 52.45 MB used, 52.45 MB peak
[2015.08.17-12.47.22:267]  0]LogMemory: Process Virtual Memory: 24.93 MB used, 24.93 MB peak
[2015.08.17-12.47.22:267]  0]LogMemory: Physical Memory: 4043.33 MB used, 7912.56 MB total
[2015.08.17-12.47.22:267]  0]LogMemory: Virtual Memory: 286.72 MB used, 8388608.00 MB total
[2015.08.17-12.47.22:485]  0]LogTextLocalizationManager: The requested culture ('de_DE') has no localization data; falling back to 'en' for localization and internationalization data.
[2015.08.17-12.47.23:008]  0]LogTextLocalizationManager:Warning: Loaded localization resources contain conflicting entries for (Namespace:ContentBrowser, Key:ImportAssetToolTip):
Localization Resource: (C:/Temp/Epic Games/4.8/Engine/Content/Localization/Editor/en/Editor.locres) Source String Hash: (-630476809) Localized String: (Import to {0}...)
Localization Resource: (C:/Temp/Epic Games/4.8/Engine/Content/Localization/Editor/en/Editor.locres) Source String Hash: (1271782899) Localized String: (Imports an asset from file to this folder.)
[2015.08.17-12.47.23:464]  0]LogD3D11RHI: Found D3D11 adapter 0: Intel(R) HD Graphics 4600 (Feature Level 11_0)
[2015.08.17-12.47.23:464]  0]LogD3D11RHI: Adapter has 64MB of dedicated video memory, 0MB of dedicated system memory, and 1632MB of shared system memory, 3 output[s]
[2015.08.17-12.47.23:464]  0]LogD3D11RHI: Chosen D3D11 Adapter Id = 0
[2015.08.17-12.47.23:473]  0]LogD3D11RHI: InitD3DDevice
[2015.08.17-12.47.23:473]  0]LogD3D11RHI: !Direct3DDevice
[2015.08.17-12.47.23:473]  0]LogRHI: Texture pool is 616 MB (70% of 880 MB)
[2015.08.17-12.47.23:481]  0]LogD3D11RHI: Async texture creation enabled
[2015.08.17-12.47.23:487]  0]LogShaderCompilers:Display: Using Local Shader Compiler.
[2015.08.17-12.47.24:488]  0]LogTemp:Display: Loaded TP DesktopTargetPlatform
[2015.08.17-12.47.24:502]  0]LogTemp:Display: Loaded TP WindowsClientTargetPlatform
[2015.08.17-12.47.24:517]  0]LogTemp:Display: Loaded TP WindowsNoEditorTargetPlatform
[2015.08.17-12.47.24:533]  0]LogTemp:Display: Loaded TP WindowsServerTargetPlatform
[2015.08.17-12.47.24:554]  0]LogTemp:Display: Loaded TP WindowsTargetPlatform
[2015.08.17-12.47.24:567]  0]LogTemp:Display: Loaded TP AndroidTargetPlatform
[2015.08.17-12.47.24:580]  0]LogTemp:Display: Loaded TP Android_ASTCTargetPlatform
[2015.08.17-12.47.24:592]  0]LogTemp:Display: Loaded TP Android_ATCTargetPlatform
[2015.08.17-12.47.24:606]  0]LogTemp:Display: Loaded TP Android_DXTTargetPlatform
[2015.08.17-12.47.24:624]  0]LogTemp:Display: Loaded TP Android_ETC1TargetPlatform
[2015.08.17-12.47.24:654]  0]LogTemp:Display: Loaded TP Android_ETC2TargetPlatform
[2015.08.17-12.47.24:670]  0]LogTemp:Display: Loaded TP Android_PVRTCTargetPlatform
[2015.08.17-12.47.24:725]  0]LogTemp:Display: Loaded TP IOSTargetPlatform
[2015.08.17-12.47.24:738]  0]LogTemp:Display: Loaded TP LinuxNoEditorTargetPlatform
[2015.08.17-12.47.24:750]  0]LogTemp:Display: Loaded TP LinuxServerTargetPlatform
[2015.08.17-12.47.24:766]  0]LogTemp:Display: Loaded TP LinuxTargetPlatform
[2015.08.17-12.47.24:766]  0]LogTargetPlatformManager:Display: Building Assets For Windows
[2015.08.17-12.47.25:000]  0]LogDerivedDataCache:Display: Max Cache Size: 512 MB
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache: Loaded boot cache 0.08s 55MB C:/Users/dhlhse24_12/AppData/Local/UnrealEngine/4.8/DerivedDataCache/Boot.ddc.
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache:Display: Loaded Boot cache: C:/Users/dhlhse24_12/AppData/Local/UnrealEngine/4.8/DerivedDataCache/Boot.ddc
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache: FDerivedDataBackendGraph:  Pak pak cache file ../../../../../DragonBorn/DerivedDataCache/DDC.ddp not found, will not use a pak cache.
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache: Unable to find inner node Pak for hierarchical cache Hierarchy.
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache: FDerivedDataBackendGraph:  CompressedPak pak cache file ../../../../../DragonBorn/DerivedDataCache/Compressed.ddp not found, will not use a pak cache.
[2015.08.17-12.47.25:077]  0]LogDerivedDataCache: Unable to find inner node CompressedPak for hierarchical cache Hierarchy.
[2015.08.17-12.47.25:241]  0]LogDerivedDataCache:Display: Pak cache opened for reading ../../../Engine/DerivedDataCache/Compressed.ddp.
[2015.08.17-12.47.25:252]  0]LogDerivedDataCache: Using Local data cache path C:/Users/dhlhse24_12/AppData/Local/UnrealEngine/Common/DerivedDataCache: Writable
[2015.08.17-12.47.25:468]  0]ImportText (ComponentSweepMultiTests): Missing closing parenthesis: (RootShapeAsset="/Engine/BasicShapes/Cube.Cube",ShapeType="TriggerCapsule",HitResult=(Time=0.50,Location=(X=-100.000015,Y=0.0,Z=100.000015),ImpactPoint=(X=-50.0,Y=0.0,Z=50.0),Normal=(X=-1.0,Y=-0.0,Z=0.0),ImpactNormal=(X=0.0,Y=0.0,Z=1.0),TraceStart=(X=-200.0,Y=0.0,Z=200.0),TraceEnd=(X=0.0,Y=0.0,Z=0.0))
[2015.08.17-12.47.25:468]  0]ImportText (LineTraceSingleByChannelTests): Missing closing parenthesis: (RootShapeAsset="/Engine/BasicShapes/Cube.Cube",HitResult=(Time=0.50,Location=(X=-100.000015,Y=0.0,Z=100.000015),ImpactPoint=(X=-50.0,Y=0.0,Z=50.0),Normal=(X=-1.0,Y=-0.0,Z=0.0),ImpactNormal=(X=0.0,Y=0.0,Z=1.0),TraceStart=(X=-200.0,Y=0.0,Z=200.0),TraceEnd=(X=0.0,Y=0.0,Z=0.0))
[2015.08.17-12.47.25:474]  0]LogInit: Selected Device Profile: [Windows]
[2015.08.17-12.47.25:499]  0]LogMeshUtilities: No automatic mesh reduction module available
[2015.08.17-12.47.25:499]  0]LogMeshUtilities: No automatic mesh merging module available
[2015.08.17-12.47.26:048]  0]LogInit: WinSock: version 1.1 (2.2), MaxSocks=32767, MaxUdp=65467
[2015.08.17-12.47.26:516]  0]LogD3D11RHI: InitD3DDevice
[2015.08.17-12.47.26:637]  0]DBNet:Warning: DBNetworkClient: Constructor called.
[2015.08.17-12.47.26:637]  0]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.17-12.47.26:637]  0]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.17-12.47.26:638]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.17-12.47.26:674]  0]SourceControl: Info Source control is disabled
[2015.08.17-12.47.26:674]  0]SourceControl: Info Source control is disabled
[2015.08.17-12.47.26:690]  0]SourceControl: Info Source control is disabled
[2015.08.17-12.47.26:827]  0]LogObj: 24997 objects as part of root set at end of initial load.
[2015.08.17-12.47.26:827]  0]LogUObjectAllocator: 5032848 out of 0 bytes used by permanent object pool.
[2015.08.17-12.47.26:898]  0]LogAutomationTest:Warning: ERR: Transient text cannot be serialized "Testing Transient serialization detection".
[2015.08.17-12.47.26:898]  0]LogEngine: Initializing Engine...
[2015.08.17-12.47.27:000]  0]LogInit: XAudio2 using 'Speaker/HP (Realtek High Definition Audio)' : 2 channels at 48 kHz using 32 bits per sample (channel mask 0x3)
[2015.08.17-12.47.27:010]  0]LogInit: FAudioDevice initialized.
[2015.08.17-12.47.27:019]  0]LogInit: Texture streaming: Disabled
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBGameInstance: Init called.
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBNetworkClient: Constructor called.
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBGameInstance: PhotonClient created.
[2015.08.17-12.47.27:146]  0]DBNet:Warning: DBNetworkClient: PhotonPeer connect called.
[2015.08.17-12.47.27:148]  0]LogNet: Browse: /Temp/Autosaves/Game/Maps/UEDPCLoginMap?Name=Player
[2015.08.17-12.47.27:148]  0]LogLoad: LoadMap: /Temp/Autosaves/Game/Maps/UEDPCLoginMap?Name=Player
[2015.08.17-12.47.27:163]  0]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x00000000140DDA80
[2015.08.17-12.47.27:177]  0]LogMemory: Platform Memory Stats for Windows
[2015.08.17-12.47.27:177]  0]LogMemory: Process Physical Memory: 340.83 MB used, 361.95 MB peak
[2015.08.17-12.47.27:177]  0]LogMemory: Process Virtual Memory: 302.54 MB used, 410.38 MB peak
[2015.08.17-12.47.27:177]  0]LogMemory: Physical Memory: 4331.30 MB used, 7912.56 MB total
[2015.08.17-12.47.27:177]  0]LogMemory: Virtual Memory: 796.06 MB used, 8388608.00 MB total
[2015.08.17-12.47.27:177]  0]LogMemory: 
[2015.08.17-12.47.27:177]  0]Allocator Stats for TBB: (not implemented)
[2015.08.17-12.47.27:238]  0]LogAIModule: Creating AISystem for world LoginMap
[2015.08.17-12.47.27:239]  0]LogWorld: Game class is 'DBGameMode'
[2015.08.17-12.47.27:240]  0]LogWorld: Bringing World /Temp/Autosaves/Game/Maps/UEDPCLoginMap.LoginMap up for play (max tick rate 0) at 2015.08.17-14.47.27
[2015.08.17-12.47.27:240]  0]DB:Warning: ==========================================
[2015.08.17-12.47.27:240]  0]DB:Warning:   Init Game Option: ?Name=Player
[2015.08.17-12.47.27:240]  0]DB:Warning:   Init Game Map: UEDPCLoginMap
[2015.08.17-12.47.27:240]  0]DB:Warning:   Init Game Error: 
[2015.08.17-12.47.27:240]  0]LogWorld: Bringing up level for play took: 0.000403
[2015.08.17-12.47.27:241]  0]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.17-12.47.27:241]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.17-12.47.27:241]  0]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.17-12.47.27:241]  0]DBNet: DBLoginHandler: OwningGameInstance: DBGameInstance_0.
[2015.08.17-12.47.27:241]  0]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: LoginHandler.
[2015.08.17-12.47.27:241]  0]DBNet: DBNetworkListener: Handler got: LoginHandler.

My GameInstance looks like:

DBGameInstance.h


// Copyright 2015 by Nethersoft ( Kenter) - All rights reserved.

#pragma once

#include "Engine/GameInstance.h"
#include "DBNetworkClient.h"
#include "DBNetworkBaseHandler.h"
#include "DBGameInstance.generated.h"

/**
 * 
 */
UCLASS()
class DRAGONBORN_API UDBGameInstance : public UGameInstance
{
    GENERATED_BODY()

public:
    virtual void Init() override;
    virtual void Shutdown() override;
    void PhotonCallService(bool dispatchIncomingCommands);

    UDBNetworkClient* PhotonClient;
};

DBGameInstance.cpp


// Copyright 2015 by Nethersoft ( Kenter) - All rights reserved.

#include "DragonBorn.h"
#include "DBGameInstance.h"

void UDBGameInstance::Init()
{
    UE_LOG(DBNet, Warning, TEXT("DBGameInstance: Init called."));
    PhotonClient = NewObject<UDBNetworkClient>();

    if (PhotonClient)
    {
        UE_LOG(DBNet, Warning, TEXT("DBGameInstance: PhotonClient created."));
        PhotonClient->PhotonConnect("127.0.0.1:5055", "MasterServer");
    }
    else
    {
        UE_LOG(DBNet, Error, TEXT("DBGameInstance: PhotonClient could not be created."));
    }
}

void UDBGameInstance::Shutdown()
{
    Super::Shutdown();
}

void UDBGameInstance::PhotonCallService(bool dispatchIncomingCommands)
{
    UE_LOG(DBNet, Log, TEXT("DBGameInstance: Service called."));

    if (PhotonClient && (PhotonClient->GetPhotonIsConnecting() || PhotonClient->GetPhotonIsConnected()))
    {
        PhotonClient->PhotonCallService(dispatchIncomingCommands);
    }
}

Hi,

I don’t get why you think it’s linked to GameInstance?

if you look in the stack trace your issue is in :DBNetworkListener::setCurrentHandler()

This is what you should track, it might be a pointer that is not initialized or you are using a ressource that has not been cooked (like images that are not “asset” but plain image)
etc…

More, we don’t have the “real error message” but only fatal error, this is what I raide to Epic here:https://answers.unrealengine.com/questions/279711/no-error-message-in-log-during-crash.html if you want to add a comment that will help to get their attention on this issue.

In the meantime, I suggest that you run the Development version of your game directly from Visual Studio (or you attach the process once launched) so you can see exactly what the errors is follow the path to your root issue.

@ Elvince - It’s because I suggested it above, but that doesn’t seem to be the cause of the problem after all.

But yeah, the next suggestion from me would be check for null pointers.

Thanks for your replies but perhaps I’m to dense to get the point. If the problem exists within DBNetworkListener::setCurrentHandler() as the trace suggests than I do not understand the problem:


void DBNetworkListener::setCurrentHandler(UDBNetworkBaseHandler* handler)
{
    FString HandlerName;
    handler->GetName(HandlerName);
    FString HandlerClass = handler->GetFullName();

    UE_LOG(DBNet, Error, TEXT("DBNetworkListener: Handler got: %s of type: %s."), *HandlerName, *HandlerClass);

    if (handler)
    {
        UDBNetworkBaseHandler* currentHandler = handler;
    }
}

If handler is a null-pointer than the if statement should fail and nothing should happen - right? But even if this is a null pointer at this time - why the heck does PIE ignore it and run? I have implemented logs for almost every function I call in the chain and from what I can say everything in PIE looks correct:


[2015.08.18-19.51.20:211][770]LogPlayLevel: PIE: Created PIE world by copying editor world from /Game/Maps/LoginMap.LoginMap to /Game/Maps/UEDPIE_0_LoginMap.LoginMap (0.002275s)
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBGameInstance: Init called.
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBGameInstance: Creating DBNetworkClient (PhotonClient).
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBNetworkClient: PostInitProperties called.
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBGameInstance: DBNetworkClient (PhotonClient) created.
[2015.08.18-19.51.20:236][770]DBNet:Warning: DBNetworkClient: PhotonPeer connect called.
[2015.08.18-19.51.20:240][770]LogInit: XAudio2 using 'Speakers (Realtek High Definition Audio)' : 2 channels at 48 kHz using 32 bits per sample (channel mask 0x3)
[2015.08.18-19.51.20:253][770]LogInit: FAudioDevice initialized.
[2015.08.18-19.51.20:285][770]LogWorld: Game class is 'DBGameMode'
[2015.08.18-19.51.20:289][770]LogWorld: Bringing World /Game/Maps/UEDPIE_0_LoginMap.LoginMap up for play (max tick rate 0) at 2015.08.18-21.51.20
[2015.08.18-19.51.20:289][770]DB:Warning: DBGameMode: ==========================================
[2015.08.18-19.51.20:289][770]DB:Warning: DBGameMode:   Init Game Option: 
[2015.08.18-19.51.20:289][770]DB:Warning: DBGameMode:   Init Game Map: UEDPIE_0_LoginMap
[2015.08.18-19.51.20:289][770]DB:Warning: DBGameMode:   Init Game Error: 
[2015.08.18-19.51.20:289][770]LogActor:Warning: GameSession /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.GameSession_2 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2015.08.18-19.51.20:290][770]LogActor:Warning: GameNetworkManager /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.GameNetworkManager_2 has natively added scene component(s), but none of them were set as the actor's RootComponent - picking one arbitrarily
[2015.08.18-19.51.20:290][770]LogWorld: Bringing up level for play took: 0.001693
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBNetworkBaseHandler: Constructor called.
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBLoginHandler: OwningGameInstance: DBGameInstance_5.
[2015.08.18-19.51.20:291][770]DBNet:Error: DBLoginHandler: Handler got: DBLoginHandler_10 of type: DBLoginHandler /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.DBLoginController_11.DBLoginHandler_10.
[2015.08.18-19.51.20:291][770]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: DBLoginHandler_10.
[2015.08.18-19.51.20:291][770]DBNet:Error: DBNetworkListener: Handler got: DBLoginHandler_10 of type: DBLoginHandler /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.DBLoginController_11.DBLoginHandler_10.
[2015.08.18-19.51.20:292][770]DBNet:Warning: DBLoginController: BeginPlay()
[2015.08.18-19.51.20:292][770]DBNet:Warning: DBLoginController: GameInstance set to DBGameInstance_5.
[2015.08.18-19.51.20:292][770]PIE: Info Play in editor start time for /Game/Maps/UEDPIE_0_LoginMap -0.205
[2015.08.18-19.51.20:292][770]DBNet:Warning: DBGameInstance: Service called.

What I try to do:

The GameInstance creates in its Init function the NetworkClient. The Networklient creates the NetwortListener and the PhotonPeer with the NetworkListener as a callback class. When the map load I spawn an actor (LoginController) with an autoactivated component LoginHandler, which is derived from NetworkBaseHandler. This component sets itself as the current handler via the instance to the NetworkListener. In the tick() function of the actor I call the service method of the instance which itself calls the service function of the NetworkClient. The data coming back from the server gets to the NeworkListener which call the corresponding function of the handler (e.g. LoginHandler).

Perhaps I’m a little naive but I thought when the project compiles without errors that it should run without errors and if the package process runs without errors the packaged game should run even moreso.

Except for the fact that you try to call functions on handler twice before checking if handler is valid. Refer to “handler->GetName(HandlerName);” and “FString HandlerClass = handler->GetFullName();”. Why its potentially NULL in a packaged game vs in PIE, I cannot answer, but I’m guessing something further up the stack trace is silently failing and preventing handler from being created.

I will just add that the garbagge collector in PIE and in package game is not doing exactly the same job.
Did you check that your “handler” is not garbagged? Did you keep it inside a UPROPERTY variable to maintain it ?

And your test on the pointer is inneficient as you are using it twice before reaching the test - same comment as

Sorry missed the check. I’ve come a little bit further. PIE runs like ever but in the standalone build I crash when calling the service method on the PhotonPeer.


[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBGameInstance: Init called.
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBGameInstance: Creating DBNetworkClient (PhotonClient).
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBNetworkClient: PostInitProperties called.
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBNetworkClient: PhotonListener created.
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBNetworkClient: PhotonPeer created.
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBGameInstance: DBNetworkClient (PhotonClient) created.
[2015.08.19-07.34.11:801]  0]DBNet:Warning: DBNetworkClient: PhotonPeer connect called.
[2015.08.19-07.34.11:802]  0]LogNet: Browse: /Temp/Autosaves/Game/Maps/UEDPCLoginMap?Name=Player
[2015.08.19-07.34.11:802]  0]LogLoad: LoadMap: /Temp/Autosaves/Game/Maps/UEDPCLoginMap?Name=Player
[2015.08.19-07.34.11:815]  0]LogParticles: Destroying 0 GPU particle simulations for FXSystem 0x000000E414B93240
[2015.08.19-07.34.11:824]  0]LogMemory: Platform Memory Stats for Windows
[2015.08.19-07.34.11:824]  0]LogMemory: Process Physical Memory: 355.48 MB used, 405.16 MB peak
[2015.08.19-07.34.11:824]  0]LogMemory: Process Virtual Memory: 403.07 MB used, 482.33 MB peak
[2015.08.19-07.34.11:824]  0]LogMemory: Physical Memory: 2324.45 MB used, 4053.68 MB total
[2015.08.19-07.34.11:824]  0]LogMemory: Virtual Memory: 939.54 MB used, 134217728.00 MB total
[2015.08.19-07.34.11:824]  0]LogMemory: 
[2015.08.19-07.34.11:824]  0]Allocator Stats for TBB: (not implemented)
[2015.08.19-07.34.11:918]  0]LogAIModule: Creating AISystem for world LoginMap
[2015.08.19-07.34.11:918]  0]LogWorld: Game class is 'DBGameMode'
[2015.08.19-07.34.11:920]  0]LogWorld: Bringing World /Temp/Autosaves/Game/Maps/UEDPCLoginMap.LoginMap up for play (max tick rate 0) at 2015.08.19-09.34.11
[2015.08.19-07.34.11:920]  0]DB:Warning: DBGameMode: ==========================================
[2015.08.19-07.34.11:920]  0]DB:Warning: DBGameMode:   Init Game Option: ?Name=Player
[2015.08.19-07.34.11:920]  0]DB:Warning: DBGameMode:   Init Game Map: UEDPCLoginMap
[2015.08.19-07.34.11:920]  0]DB:Warning: DBGameMode:   Init Game Error: 
[2015.08.19-07.34.11:921]  0]LogWorld: Bringing up level for play took: 0.000431
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBNetworkBaseHandler: Constructor called.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBLoginHandler: OwningGameInstance: DBGameInstance_0.
[2015.08.19-07.34.11:922]  0]DBNet:Error: DBLoginHandler: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Temp/Autosaves/Game/Maps/UEDPCLoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: DBLoginHandler_0.
[2015.08.19-07.34.11:922]  0]DBNet:Error: DBNetworkListener: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Temp/Autosaves/Game/Maps/UEDPCLoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBLoginController: BeginPlay()
[2015.08.19-07.34.11:922]  0]DBNet:Warning: DBLoginController: GameInstance set to DBGameInstance_0.
[2015.08.19-07.34.11:922]  0]LogInit:Display: Game Engine Initialized.
[2015.08.19-07.34.12:189]  0]LogAssetRegistry: FAssetRegistry took 0.0002 seconds to start up
[2015.08.19-07.34.12:190]  0]LogLoad: Full Startup: 7.76 seconds (BP compile: 0.01 seconds)
[2015.08.19-07.34.12:208]  0]LogContentStreaming: Texture pool size is 1000.000000MB
[2015.08.19-07.34.12:258]  1]DBNet:Warning: DBGameInstance: Service called. Attepting to call Service from the PhotonClient...
[2015.08.19-07.34.12:258]  1]DBNet:Warning: DBNetworkClient. Service called. Calling Service from the PhotonPeer...
[2015.08.19-07.34.20:450]  1]LogRenderer: Reallocating scene render targets to support 1280x720 (Frame:2).


The same in the coocked build:


rld: Game class is 'DBGameMode'
[2015.08.19-07.39.10:363]  0]LogWorld: Bringing World /Game/Maps/LoginMap.LoginMap up for play (max tick rate 0) at 2015.08.19-09.39.10
[2015.08.19-07.39.10:363]  0]DB:Warning: DBGameMode: ==========================================
[2015.08.19-07.39.10:363]  0]DB:Warning: DBGameMode:   Init Game Option: ?Name=Player
[2015.08.19-07.39.10:363]  0]DB:Warning: DBGameMode:   Init Game Map: LoginMap
[2015.08.19-07.39.10:363]  0]DB:Warning: DBGameMode:   Init Game Error: 
[2015.08.19-07.39.10:363]  0]LogWorld: Bringing up level for play took: 0.000721
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBGameMode: Begin Play.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBLoginController: Constructor called.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBNetworkBaseHandler: Constructor called.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBLoginHandler: InitializeComponent.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBLoginHandler: OwningGameInstance: DBGameInstance_0.
[2015.08.19-07.39.10:367]  0]DBNet:Error: DBLoginHandler: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Game/Maps/LoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: DBLoginHandler_0.
[2015.08.19-07.39.10:367]  0]DBNet:Error: DBNetworkListener: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Game/Maps/LoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBLoginController: BeginPlay()
[2015.08.19-07.39.10:367]  0]DBNet:Warning: DBLoginController: GameInstance set to DBGameInstance_0.
[2015.08.19-07.39.10:368]  0]LogInit:Display: Game Engine Initialized.
[2015.08.19-07.39.10:586]  0]LogAssetRegistry: FAssetRegistry took 0.0159 seconds to start up
[2015.08.19-07.39.10:587]  0]LogLoad: Full Startup: 2.74 seconds (BP compile: 0.00 seconds)
[2015.08.19-07.39.10:615]  0]LogContentStreaming: Texture pool size is 1000.000000MB
[2015.08.19-07.39.10:679]  1]DBNet:Warning: DBGameInstance: Service called. Attepting to call Service from the PhotonClient...
[2015.08.19-07.39.10:679]  1]DBNet:Warning: DBNetworkClient. Service called. Calling Service from the PhotonPeer...
[2015.08.19-07.39.10:947]  1]LogRenderer: Reallocating scene render targets to support 1600x904 (Frame:2).

It’s me again,

I dived deeper into the issue with my code and found out that the crash is not coming from DBNetworkListener::setCurrentHandler. Instead it’s coming from DBNetworkListener::onStatusChanged. What I did was (my first real :cool:) debugging in VS and adding some checks to the code.

I got inspired by a thread an answerhub (Crash: Multi-threading timing issue- rendering while shutting down - Programming & Scripting - Epic Developer Community Forums) which leads me to the point that an UObject pointer can pass a simple check:

by RAMA

It appears that the call to DBNetworkListener::setCurrentHandler passes all checks:


void DBNetworkListener::setCurrentHandler(UDBNetworkBaseHandler* handler)
{
    if (handler && handler->IsValidLowLevel())
    {
        FString HandlerName;
        handler->GetName(HandlerName);
        FString HandlerClass = handler->GetFullName();

        UE_LOG(DBNet, Error, TEXT("DBNetworkListener: Handler got: %s of type: %s."), *HandlerName, *HandlerClass);

        UDBNetworkBaseHandler* currentHandler = handler;
        FString CurrentHandlerName;
        FString CurrentHandlerClass = currentHandler->GetFullName();
        currentHandler->GetName(CurrentHandlerName);
        UE_LOG(DBNet, Error, TEXT("DBNetworkListener: Handler got: %s of type: %s."), *CurrentHandlerName, *CurrentHandlerClass);
    }
}

In the Logs I see the corresponding entries:


[2015.08.19-14.40.15:026][843]DBNet:Error: DBLoginHandler: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-14.40.15:027][843]DBNet:Warning: DBNetworkClient: PhotonSetCurrentHandler called and set to: DBLoginHandler_0.
Function: DBNetworkListener::setCurrentHandler(UDBNetworkBaseHandler *), Thread: 0x45C Main Thread,     UE4Editor-DragonBorn-Win64-DebugGame.dll!DBNetworkListener::setCurrentHandler
    UE4Editor-DragonBorn-Win64-DebugGame.dll!UDBNetworkClient::PhotonSetCurrentHandler
    UE4Editor-DragonBorn-Win64-DebugGame.dll!UDBLoginHandler::InitializeComponent
    UE4Editor-Engine.dll!UActorComponent::RegisterComponentWithWorld
    UE4Editor-Engine.dll!UActorComponent::RegisterComponent
    UE4Editor-DragonBorn-Win64-DebugGame.dll!ADBGameMode::BeginPlay
    UE4Editor-Engine.dll!AWorldSettings::NotifyBeginPlay
    UE4Editor-Engine.dll!AGameMode::HandleMatchHasStarted
    UE4Editor-Engine.dll!AGameMode::SetMatchState
    UE4Editor-Engine.dll!AGameMode::StartMatch
    UE4Editor-Engine.dll!UWorld::BeginPlay
    UE4Editor-Engine.dll!UGameInstance::StartPIEGameInstance
    UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEGameInstance
    UE4Editor-UnrealEd.dll!UEditorEngine::PlayInEditor
    UE4Editor-UnrealEd.dll!UEditorEngine::StartQueuedPlayMapRequest
    UE4Editor-UnrealEd.dll!UEditorEngine::Tick
    UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick
    UE4Editor.exe!FEngineLoop::Tick
    UE4Editor.exe!GuardedMain
    UE4Editor.exe!WinMain
    UE4Editor.exe!__tmainCRTStartup
    kernel32.dll!BaseThreadInitThunk
    ntdll.dll!RtlUserThreadStart
    , UDBNetworkClient::PhotonSetCurrentHandler
[2015.08.19-14.40.15:481][843]DBNet:Error: DBNetworkListener: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-14.40.15:482][843]DBNet:Error: DBNetworkListener: Handler got: DBLoginHandler_0 of type: DBLoginHandler /Game/Maps/UEDPIE_0_LoginMap.LoginMap:PersistentLevel.DBLoginController_0.DBLoginHandler_0.
[2015.08.19-14.40.15:483][843]DBNet:Warning: DBLoginController: BeginPlay()
[2015.08.19-14.40.15:484][843]DBNet:Warning: DBLoginController: GameInstance set to DBGameInstance_0.
[2015.08.19-14.40.15:485][843]PIE: Info Play in editor start time for /Game/Maps/UEDPIE_0_LoginMap 1
[2015.08.19-14.40.15:485][843]DBNet:Warning: DBGameInstance: Service called. Attepting to call Service from the PhotonClient...
[2015.08.19-14.40.15:486][843]DBNet:Warning: DBNetworkClient. Service called. Calling Service from the PhotonPeer...

But when it comes to the answer from the server it crashes due to IsValidLowLevel() fails:


UE4Editor-CoreUObject.dll!UObjectBase::IsValidLowLevel() Line 213    C++
>    UE4Editor-DragonBorn-Win64-DebugGame.dll!DBNetworkListener::onStatusChanged(int statusCode) Line 17    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!ExitGames::Photon::Internal::PeerBase::deserializeOperation(unsigned char *,int)    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!ExitGames::Photon::Internal::EnetPeer::dispatchIncomingCommands(void)    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!ExitGames::Photon::Internal::PeerBase::service(bool)    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!UDBNetworkClient::PhotonCallService(bool dispatchIncomingCommands) Line 83    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!UDBGameInstance::PhotonCallService(bool dispatchIncomingCommands) Line 39    C++
     UE4Editor-DragonBorn-Win64-DebugGame.dll!ADBLoginController::Tick(float DeltaTime) Line 47    C++
     UE4Editor-Engine.dll!AActor::TickActor(float DeltaSeconds, ELevelTick TickType, FActorTickFunction & ThisTickFunction) Line 670    C++
     UE4Editor-Engine.dll!FActorTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 105    C++
     UE4Editor-Engine.dll!FTickTaskSequencer::FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 113    C++
     UE4Editor-Engine.dll!TGraphTask<FTickTaskSequencer::FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 753    C++
     UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 430    C++
     UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 273    C++
     UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 991    C++
     UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 243    C++
     UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 643    C++
     UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 697    C++
     UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1181    C++
     UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1339    C++
     UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 366    C++
     UE4Editor.exe!FEngineLoop::Tick() Line 2359    C++
     UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142    C++
     UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 189    C++
     UE4Editor.exe!__tmainCRTStartup() Line 618    C
     kernel32.dll!BaseThreadInitThunk()    Unknown
     ntdll.dll!RtlUserThreadStart()    Unknown


It seems that currentHandler is no longer a valid pointer.

&stc=1

But I can not get why.

Edit:

Using IsValidLowLevelFast(true) on the currentHandler gives the result that the pointer is “misaligned”.


[2015.08.19-15.00.05:744][281]DBNet:Warning: DBNetworkClient. Service called. Calling Service from the PhotonPeer...
Function: DBNetworkListener::onStatusChanged(int), Thread: 0x16F8 Main Thread, ExitGames::Photon::Internal::PeerBase::deserializeOperation, 0x000007FED4DFD9AE
[2015.08.19-15.00.05:802][281]LogUObjectBase:Error: 'this' pointer is misaligned.

Have you check where your pointer is stored?

Does your property handling your pointer is marked with a UPROPERTY?

That was the point - thanks Elvince!

In my DBNetworkListener.h I had:


// Reference to the current handler
    UDBNetworkBaseHandler* currentHandler;

and in DBNetworkListener.cpp:


UDBNetworkBaseHandler* currentHandler = handler;

I changed this to:


// Reference to the current handler
    UPROPERTY()
    UDBNetworkBaseHandler* currentHandler;

and


currentHandler = handler;

and it works.

So independent from all other checks and updates to the code it finally came to this litte word not placed? Unbelievable!

Thanks to everyone pointing me to the right direction. I will print this and pin it to my wall to never forget about it :smiley:

So as a result in my opinion PIE is more forgiving than StandAlone or PackedGame. Nevertheless an detailed error description should have pointed that out earlier as mentiond by Elvince.

Ah yeah, basically unless you mark it with UPROPERTY() it’ll be garbage-collected. Sometimes instantly, sometimes every 60 seconds.

It would be worth reading up about the UE4 Garbage System :slight_smile: They did a blog post on it a while back!

Glad it is fixed.

You face this once and after you won’t forget :smiley:

REf to the Garbage Collection wiki : https://wiki.unrealengine.com/Garbage_Collection_Overview