[5.10] FREEZE Game freezes when new start is selected

Ask here if you experience technical problems with X4: Foundations.

Moderator: Moderators for English X Forum

Post Reply
blackice7777
Posts: 32
Joined: Thu, 8. Sep 16, 12:47
x4

[5.10] FREEZE Game freezes when new start is selected

Post by blackice7777 » Sun, 14. Aug 22, 16:13

1. 5.10 English
2. Clean game
3. Game start - none
4. Game freezes when new game start is selected. Reproducibility - always.
I've recorded video that demonstrates this: https://youtu.be/b9x2Dn5ZB04
5. Relevant changes: switched language from russian to English
6. System information:
DxDiag:
https://drive.google.com/file/d/1P1uwTj ... sp=sharing

Vulkaninfo:
https://drive.google.com/file/d/1AYpKdc ... sp=sharing

Debug log:
https://drive.google.com/file/d/1k7ELNK ... sp=sharing

Notes:
I already have 2.4k hours in game and was able to run game modded and clean for hours. At some point I've noticed that game started to freeze after 2-5 minutes of playing. I deleted all mods, did game files verification with steam, updated all drivers but the problem remains.
There were no changes in my harware or software.
Here is save file that causes the game to freeze every 2-5 minutes, game is clean
https://drive.google.com/file/d/16u3ZoZ ... sp=sharing

Log:
https://drive.google.com/file/d/1WRb4AH ... sp=sharing
It has exactly the same symptoms as on video but during gameplay. Log file shows the same errors, so I think that the root of the problem is similar, but could provide the additional info.

I'm pro software developer and can provide any assistance.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 30368
Joined: Fri, 16. Apr 04, 19:21
x4

Re: [5.10] FREEZE Game freezes when new start is selected

Post by Alan Phipps » Sun, 14. Aug 22, 18:12

Just a couple of things from the DxDiag: you have a Nahimic sound device operating with what looks like a broken/missing driver, and if your pagefile/swapfile is on your C: drive then there is not enough free space left for it. I don't know if these are related to your game freeze issue but they may not be helping.

All of your Windows Error Reports are LiveKernelEvents which are usually related to driver or hardware/set-up issues.
A dog has a master; a cat has domestic staff.

blackice7777
Posts: 32
Joined: Thu, 8. Sep 16, 12:47
x4

Re: [5.10] FREEZE Game freezes when new start is selected

Post by blackice7777 » Wed, 17. Aug 22, 14:17

I've disbaled swap file to totaly exclude this possible influence. The Nahimic device is a system device that can't be uninstalled or diabled (all my attempts failed), but there are no bluetooth devices connected to the pc. So it could hardly be a problem. I've also updated/reinstalled all drivers. I've tried to run the game in different modes - fullscreen, windowed, with different gfx settings. Still have the same issue.

The logs provided show exactly that vkQueueSubmit returns error - device lost, for unknown reason. It could be result of fixes in nvidia drivers, vulkan api that affects the application code.

I understand this is a rare problem, and it has zero chance to be fixed, since I doubt, that developers can reproduce it on their hardware. For now I'm going to invetagate it as deeply as I can to provide some usefull input.

blackice7777
Posts: 32
Joined: Thu, 8. Sep 16, 12:47
x4

Re: [5.10] FREEZE Game freezes when new start is selected

Post by blackice7777 » Fri, 19. Aug 22, 18:56

I've finished the investigation. I put the report into the spoiler section as it is overloaded with technical details and intended for developers. I hope, they will read it.
Spoiler
Show
I've started the investigation with an assumption that if problem is reproduced exactly in the same place, it is not a harware problem.
Having not much tools in my disposal I've implemented special dll, namely - vulkan-2.dll that works as a thunk between app and vulkan-1.dll.
This dll exports all vulkan methods that app imports. So, I've intercepted all calls from the app to vulkan api and output it into log file.
It grows very quickly to several megabytes, and I grabbed the only final part, where error happens:

144553328:0x20F4 =======================================
144553328:0x20F4 Vulkan thunk log started, main thread: 0x000020F4
144553328:0x20F4 =======================================
144554984:0x20F4 vkGetInstanceProcAddr() -> vkGetPhysicalDeviceSurfaceSupportKHR, ret: 0x00007FFB837F1B20
144554984:0x20F4 vkGetInstanceProcAddr() -> vkGetPhysicalDeviceSurfaceFormatsKHR, ret: 0x00007FFB837F1B50
144554984:0x20F4 vkGetInstanceProcAddr() -> vkCreateSwapchainKHR, ret: 0x00007FFB837F1B80
144554984:0x20F4 vkGetInstanceProcAddr() -> vkDestroySwapchainKHR, ret: 0x00007FFB837F1BB0
144554984:0x20F4 vkGetInstanceProcAddr() -> vkGetSwapchainImagesKHR, ret: 0x00007FFB837F1BC0
144554984:0x20F4 vkGetInstanceProcAddr() -> vkGetPhysicalDeviceSurfaceCapabilitiesKHR, ret: 0x00007FFB837F1BF0
144554984:0x20F4 vkGetInstanceProcAddr() -> vkGetPhysicalDeviceSurfacePresentModesKHR, ret: 0x00007FFB837F1C20
144554984:0x20F4 vkGetInstanceProcAddr() -> vkQueuePresentKHR, ret: 0x00007FFB837F1C50
144554984:0x20F4 vkGetInstanceProcAddr() -> vkAcquireNextImageKHR, ret: 0x00007FFB837F2850
......
the end, usually 80-90 seconds after start while playing the new game intro:
144647671:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B2490, waitAll: 1, timeout: -1 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x000001DBC20B2490 -> ret -4
144647750:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B3260, waitAll: 1, timeout: -1 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x000001DBC20B3260 -> ret -4
144647750:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B2490, waitAll: 1, timeout: -1 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x000001DBC20B2490 -> ret -4
144647750:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B3260, waitAll: 1, timeout: -1 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x000001DBC20B3260 -> ret -4
144647750:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B2490, waitAll: 1, timeout: -1 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x0000000000000000 -> ret -4
144647750:0x20F4 vkQueueSubmit() queue: 0x000001DBCF54F6D0, count: 1, fence: 0x000001DBC20B2490 -> ret -4
144647750:0x20F4 vkWaitForFences() device: 0x000001DBCDC6AB00, fenceCount: 1, fence: 0x000001DBC20B3260, waitAll: 1, timeout: -1 -> ret -4
144647765:0x20F4 vkQueueWaitIdle() queue: 0x000001DBCF54F6D0 -> ret -4
144647765:0x20F4 vkQueueWaitIdle() queue: 0x000001DBCF54F6D0 -> ret -4

If instead of new game, I load my previous save, it freezes after several seconds with exactly the same log picture.
Just to mention, I've also intercepted the vkCreateInstance and expanded the ppEnabledExtensionNames with VK_EXT_debug_report extension,
setup the vkDebugReportCallbackEXT with all debug bits set to on. However there was no debug output from vulkan during these errors, only general
infomrational messages usually at app startup.

While experimenting with this, I've noticed, that the presence of massive logging slows down the performance (obviously) but at the same time it makes
the game life longer. I decided to check what will be the behaviour, if I would slow down it more. In every method listed above, I put Sleep(5),
and (to ,my surprise, belive it or not!) the problem magicaly disapperas. The performance penalty was at about -20 fps, i.e. on scenes where I had 75 fps,
I've got ~55 fps.
Messing around with this, I ended up with the only single Sleep(5) in vkQueueSubmit, moreover, I also implemeted the variant, that after 5 minutes of gamplay the Sleep is not invoked any longer.
For now my workaround (yes, this is not a real fix of the problem) looks like the following (TRACE outputs to log only if ret < 0):

DllExport VkResult vkQueueSubmit( VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence )
{
VkResult ret = pfnQueueSubmit( queue, submitCount, pSubmits, fence );
TRACE( ret, "vkQueueSubmit() queue: 0x%016llX, count: %u, fence: 0x%016llX -> ret %d\n", queue, submitCount, fence, ret );
if( g_bSleep ) {
Sleep( DELAY_TIME ); // 5 ms, 4 ms is also good, but the problem still apperas time to time
QWORD qwTime = GetTickCount64();
if( qwTime - g_qwStartTick >= CANCEL_SLEEP_TIME ) { // 5 minutes interval
OUTMSG( "Canceling delay\n" );
g_bSleep = false; // remove delay and get back to normal fps...
}
}
return ret;
}

I played for several hours with this workaround on clean game and on heavily modded without any troubles.
It seems, once app has passed some critical place, the rest works smoothly.

From this point I can only guess.
Sleep in multithreaded environment is not a waste of time, but a chance to other threads to finish their tasks.
You use multithreaded aproach to copmose the scene, and main thread to present final frame,
it seems that some thread still continues to modify buffer after it submittion.
If you would be so kind to apply this in all 3 places in your code, I can test it and provide the results.

...for me the time has come to finaly capture Erlking...
I'm open for any colaboration and I'm a big fun of X- games since x-tension.
with love from Ukraine,
B
Have a good day!

Post Reply

Return to “X4: Foundations - Technical Support”