Game Crash with error "d3d11: failed to lock buffer"

Our game keep crashing on some machines (Windows) with these error code.

d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].
d3d11: failed to lock buffer 000000002C75CA50 of size 647159 [0x8007000E].

repeatedly and crashed.

Specs from log (from 2 different pcs)

GfxDevice: creating device client; threaded=1
d3d11: CreateDXGIFactory2(...) not found, fallbacking to CreateDXGIFactory1(...).
d3d11: QueryInterface(IDXGIFactory5) failed (80004002).
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: AMD Radeon HD 7800 Series (ID=0x6819)
Vendor:
VRAM: 2025 MB
Driver: 25.20.15031.1000

Initialize engine version: 2019.3.8f1 (4ba98e9386ed)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.1]
Renderer: Radeon RX 570 Series (ID=0x67df)
Vendor:
VRAM: 8172 MB
Driver: 26.20.13002.133

0x8007000E seems to be a OUT_OF_MEMORY error but I've checked the profiler in Unity but the memory (and other stuffs) look normal, no potential memory leaks.

And there is also another type of crash

Initialize engine version: 2019.3.8f1 (4ba98e9386ed)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 11.0 [level 11.0]
Renderer: NVIDIA GeForce GTX 950M (ID=0x139a)
Vendor:
VRAM: 4055 MB
Driver: 26.21.14.4166

D3D11: Failed to create RenderTexture (1920 x 1080 fmt 27 aa 1), error 0x887a0005
(Filename: C:\buildslave\unity\build\Runtime/GfxDevice/d3d11/RenderTextureD3D11.cpp Line: 207)

D3D11: Failed to create RenderTexture (1920 x 1080 fmt 19 aa 1), error 0x887a0005
(Filename: C:\buildslave\unity\build\Runtime/GfxDevice/d3d11/RenderTextureD3D11.cpp Line: 207)

d3d11: failed to create staging 2D texture w=128 h=2 d3dfmt=10 [887a0005]
Crash!!!
.
.
.
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC7AEE80)
0x00007FFBEC7AEE80 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC7C85B8)
0x00007FFBEC7C85B8 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC7B16AB)
0x00007FFBEC7B16AB (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC878458)
0x00007FFBEC878458 (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC87F2CD)
0x00007FFBEC87F2CD (UnityPlayer) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFBEC87F3C5)
0x00007FFBEC87F3C5 (UnityPlayer) (function-name not available)
0x00007FFBED213C8D (UnityPlayer) UnityMain
0x00007FFC61E87BD4 (KERNEL32) BaseThreadInitThunk
0x00007FFC63D4CED1 (ntdll) RtlUserThreadStart

All of the crashes occurs randomly at anytime in the scenes.
Game might be able to run for 2-3 hours with no crash.
But sometimes only 1-10min and crashed.

Some PCs are able to run the game without any crash at all.
Some PCs always.

I have no idea what is causing this error so I welcome any suggestions or trials to fix this issue.
If you need more information, feel free to ask.

PS. my game uses many custom shaders written by our team. Is it possible that it may cause the crash?

Thank you

2 Likes

From your description, it does appears to be a graphics memory leak.

I suggest you investigate this with an external profiling tool like PIX for Windows to identify what is leaking. If you believe the leak is coming from Unity, please file a bug.

2 Likes

I'm getting the "d3d11: failed to lock buffer" crash too.
Using HDRP in Unity 2020.1
Happens in development and release builds.
Happens less with DX12.

Error.log:
"UnityPlayer.dll caused an Access Violation (0xc0000005)
in module UnityPlayer.dll at *."

Player.log (happens dozens of times per log)
DX11: "d3d11: failed to lock buffer * of size * [0x8007000E]."
DX12: "d3d12: upload buffer was full! Waited for COPY queue for * ms."

(both DX11 and DX12)
from Error.log

Module 1
C:\Windows\SYSTEM32\xinput1_3.dll
Image Base: 0x00400000 Image Size: 0x0001e000
File Size: 107368 File Time: 2007-04-04_185422
Version:
Company: Microsoft Corporation
Product: Microsoft® DirectX for Windows®
FileDesc: Microsoft Common Controller API
FileVer: 9.18.944.0
ProdVer: 9.18.944.0

----update----
It is a memory leak.
After upgrading my project to 2019.3 I was getting "task.rasterData.vertexBuffer == NULL" errors randomly in my editor.
The error wasn't causing any noticeable issues in the editor.
After testing standalone builds I was getting the crash noted above and more specific errors from 'outVertices'
\Modules\ParticleSystem\ParticleSystemGeometryJob.cpp Line: 2740

(LineRenderer and ParticleSystem in the same scene errors randomly)

Solution for my situation: Removing LineRenderers from the scene.

2 Likes

Thanks for the additional info! Could you please file a bug for this issue?

There's an active memory leak bug for LineRenderer: https://issuetracker.unity3d.com/issues/memory-leak-in-line-renderer-when-build-is-running-in-batchmode but the repro appears different (only impacts -batchmode). So we should have a separate bug to track this problem.

We have the same issue in our project, game crashes on Dx11 systems after spewing:

d3d11: failed to lock buffer 000001BB025AA198 of size 32768 [0x8007000E].
d3d11: failed to lock buffer 000001BBF1BF4058 of size 32768 [0x8007000E].
d3d11: failed to lock buffer 000001BB025AA718 of size 8192 [0x8007000E].
d3d11: failed to lock buffer 000001BBF1BF9598 of size 8192 [0x8007000E].

It looks like the issue is related to our in-game mirror reflections (camera rendering to texture, similar to the MirrorReflection4 script), as it only randomly happens when those are rendered.

EDIT: More so, we have the crash/failed to lock buffer message only if particular meshes are used to render the reflection texture.

I am seeing this too with customers, but can't figure out why. I wish I could provide more information, but basically last week we finally upgraded to Unity 2018.4.20, and since then have been seeing users getting this intermittent crash. Previously we were on Unity 2018.1, and never had this problem.
The output_log files don't seem to have much useful info. There's basically just tons of d3d11: failed to lock buffer 000002C213C21458 of size 56815 [0x8007000E] type messages. It seems like the person is able to keep playing the game for 1-2 hours, but it could indeed be a memory leak because eventually the game crashes (or rather, dies). Also, those same users will have multi-hour sessions without this error too, so it's been very hard to trace.
The only commonality I've seen so far in our reports is all AMD gfx users (but no specific card or driver).

I should also mention that similar to Skunk-Software, I have been seeing task.rasterData.vertexBuffer == NULL sometimes in the unity editor while running the game (also only since using Unity 2018.4). But, while we have line renderers and we have particle systems, I haven't found a clear reproduction case... nor do I know if this error is related to the d3d11 errors from users.

Let me know if there's anything more I can provide, thanks.

Edit: After talking with one user in particular, his crashes seemed to be somewhat timed to parts in our game where a line renderer and particle system is present. But still quite random..

1 Like

I've tested this yesterday, in our case it depends how many meshes generated with CombineMesh are rendered within "mirror reflection"/second camera. With single mesh it took 4-5 hours to start the issue, but we can reproduce it every time in couple seconds to minutes with larger quantities.

It's not issue in our code (we've tested other mirrors, including paid assets), it's not the shaders triggering it, it's only particular meshes (But not even always, as we don't have the issue if mesh is rendered on different kind of object, even if used shader is the same and the mesh renderers options are the same).

And exactly as You said, we've started having this problem around migrations in Unity 2018. It's still present in 2019 and 2020 Beta, and yes - all of our affected systems are AMD gfx, but can't confirm if it's isolated, since it crashes Unity itself, before chance to report the crash to us.

Folks, in our recent tests it seems disabling Static Batching/Dynamic Batching/GPU Skinning or Graphics Jobs at least affects the reported failed buffer lock size, can anyone else confirm the relation, or is it some fluke?

We also had similar success earlier when changing Graphics player options, but afer a while the issue came back.

EDIT: I have fairly high degree of certainty disabling Graphics Jobs is a workaround for this issue, at least in our case. In all of our testing there was never visible GPU memory leak, and it was all done on Radeon GPUs under DX11.

UPDATE: Disabling Graphics Jobs does help, and we get now only sporadic "fail to lock buffer" error, albeit with larger size buffers. Still, doesn't crashed so far.

In our case we are not using mirror reflections or multiple cameras. We also aren't using graphics jobs or GPU skinning, but do have static/dynamic batching enabled.

[quote=“Skunk-Software”, post:3, topic: 787886]
I’m getting the “d3d11: failed to lock buffer” crash too.
Using HDRP in Unity 2020.1
Happens in development and release builds.
Happens less with DX12.

Error.log:
“UnityPlayer.dll caused an Access Violation (0xc0000005)
in module UnityPlayer.dll at *.”

Player.log (happens dozens of times per log)
DX11: “d3d11: failed to lock buffer * of size * [0x8007000E].”
DX12: “d3d12: upload buffer was full! Waited for COPY queue for * ms.”

(both DX11 and DX12)
from Error.log

Module 1
C:\Windows\SYSTEM32\xinput1_3.dll
Image Base: 0x00400000 Image Size: 0x0001e000
File Size: 107368 File Time: 2007-04-04_185422
Version:
Company: Microsoft Corporation
Product: Microsoft® DirectX for Windows®
FileDesc: Microsoft Common Controller API
FileVer: 9.18.944.0
ProdVer: 9.18.944.0

----update----
It is a memory leak.
After upgrading my project to 2019.3 I was getting “task.rasterData.vertexBuffer == NULL” errors randomly in my editor.
The error wasn’t causing any noticeable issues in the editor.
After testing standalone builds I was getting the crash noted above and more specific errors from ‘outVertices’
\Modules\ParticleSystem\ParticleSystemGeometryJob.cpp Line: 2740

(LineRenderer and ParticleSystem in the same scene errors randomly)

Solution for my situation: Removing LineRenderers from the scene.
[/quote]

I’m getting this error in the editor too but not sure if it’s related to the crash I got.
If it is, then I think we should wait for 2019.3.14f1 (out approx 13th May).

More info in this post: https://discussions.unity.com/t/774336 page-2#post-5790181

Hope this fix my issue as well.

I’ll try to reproduce and report here again after Unity releases the fix.

Just confirming that since upgrading to unity 2018.4.23, the crash hasn't appeared again... at least so far.

So far without issue here too, on 19.3.14. Great job Unity devs, thanks!

Crashing in 2019.4.2f1 with Trails enabled on a particle system.
tons of "d3d11: failed to lock buffer 000001D96D694ED8 of size 3276246 [0x8007000E]." in editor logs.

========== OUTPUTTING STACK TRACE ==================

0x00007FF6F6FA1694 (Unity) BuildParticleLineSegment<0>
0x00007FF6F6FA1258 (Unity) BuildParticleLine<0>
0x00007FF6F6FE2518 (Unity) ParticleSystemTrailGeometryJob::RenderJobCommon
0x00007FF6F6FE1171 (Unity) ParticleSystemTrailGeometryJob::RenderJob
0x00007FF6F5CEF58D (Unity) JobQueue::Exec
0x00007FF6F5CF5E9B (Unity) JobQueue::Steal
0x00007FF6F5CEFDA3 (Unity) JobQueue::ExecuteJobFromQueue
0x00007FF6F5CF1853 (Unity) JobQueue::ProcessJobs
0x00007FF6F5CF6EEF (Unity) JobQueue::WorkLoop
0x00007FF6F62445C3 (Unity) Thread::RunThreadWrapper
0x00007FF9C0AE7BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF9C22CCE51 (ntdll) RtlUserThreadStart

========== END OF STACKTRACE ===========

0x8007000E is out of memory error. How much memory is your game using with the editor open?

I found a similar bug in 2018.4.29f1. when the unity exe is embedded in a winform app, and when the unity's parent User Control is hidden, there will be a memory leak in LineRender, and result in Gradual increase in memory usage. when the unity's parent User Control is shown, the memory usage will stop increasing