Closed vlad250906 closed 1 week ago
I cannot reproduce this crash on my machine; I'll look into it more. Your assumption seems right at first glance...
I get the same, I think it's because of the Better Dogs resource pack in my case (I don't get the crashes after disabling the pack, and it adds a whole lot of vertices) hs_err_pid26640.log
Has this been fixed with Iris 1.8 beta 3?
Yes, in 1.8.0-beta.3+mc1.21.1 the bug is gone. Thanks!
Minecraft Version
1.21
Iris Version
iris-1.7.3+mc1.21
Sodium Version
sodium-fabric-0.5.11+mc1.21
Operating System
Windows 10
What is your GPU?
NVIDIA GeForce GTX 1070
Java Version
Java 21
Reproduction Steps
1) Install/write a mod that has BlockEntityRenderer rendering a model with a bunch of vertices. Example:
2) Launch the game and enter any world (I will use super-flat void world). 3) Use any shaderpack (any will work; I used Iris-Example-Shaderpack-master). 4) Spam-place custom block created 5) JVM crashes
Without Iris (or if shaders are disabled) all is OK.
https://github.com/user-attachments/assets/63078db7-6a99-4012-9ac4-67c93e86e436
Crash Report file and latest.log
Additional context
hs_err_pid23976.log latest.log
The problem is probably caused by
MixinBufferBuilder::fillExtendedData
not handlingByteBufferBuilder
growth (ByteBufferBuilder::resize
) correctly.iris$beforeNext
saves direct memory pointers invertexPointers
and callsfillExtendedData
to change quad data. But if too many vertices are being added toBufferBuilder
,ByteBufferBuilder
will have to expand and double its size, reallocating itself to a new address. And now there are some addresses invertexPointers
pointing to the old freed buffer and some pointing to the new one.MemoryUtil.memPutFloat
call will crash the JVM.I wrote custom mixins for ByteBufferBuilder and BufferBuilder to catch EXCEPTION_ACCESS_VIOLATION before the JVM crashes (it checks that all addresses used in MemoryUtil.memPutFloat and MemoryUtil.memPutInt are pointing to buffer)
vertexPointers = [22d6ffeab80; 22d089da2f4; 22d089da328; 22d089da35c;] Vertex 0 is pointing to an old freed buffer with capacity 2072576 Vertex 1,2 and 3 are pointing to a new buffer with capacity 4145152
Mod used to crash Iris + Mixins: https://github.com/vlad250906/iris-crash-test Shaderpack used: https://github.com/IrisShaders/Iris-Example-Shaderpack