Skip to content

[26.2] Hard game crash (EXCEPTION_ACCESS_VIOLATION in AMD driver) while chest editor is open – glReadPixels in MagnifierRenderer #7

Open

Description

@DaPiCu

Summary

Minecraft crashes hard (the whole Java process dies, no Minecraft crash report) whenever the Absolute Order chest editor is open. It doesn't only happen when using the magnifier – clicking buttons or doing anything else in the editor can trigger it too.

The crash happens inside the AMD OpenGL driver (atio6axx.dll), but in all 3 crashes the call comes from the same place in Absolute Order: glReadPixels in MagnifierRenderer.render.

Environment

  • Absolute Order: 2.0.0 (AbsoluteOrder-2.0.0-fabric-mc26.2.jar)
  • Minecraft: 26.2
  • Fabric Loader: 0.19.5
  • Java: Microsoft OpenJDK 25.0.1
  • Launcher: Prism Launcher
  • OS: Windows
  • GPU: AMD Radeon RX 9070 XT , driver Adrenalin version: 26.10.1
  • ~124 other mods installed (list attached)

Steps to reproduce

  1. Open any chest
  2. Open the Absolute Order editor
  3. Use the editor normally (magnifier, clicking buttons, switching things)
  4. After a short time the game closes instantly

It happens very often, not just once.

What the crash logs show

All 3 hs_err logs are identical in the important part:

EXCEPTION_ACCESS_VIOLATION (0xc0000005) ... writing address ...
Problematic frame: C [atio6axx.dll+0x2406963]

Java frames:
org.lwjgl.opengl.GL11.glReadPixels
 <- io.github.marcsanzdev.chestseparators.client.ui.MagnifierRenderer.render(GuiGraphicsExtractor, int, int, boolean)+164
 <- EditorRenderer.renderMagnifier
 <- EditorRenderer.render
 <- ChestSeparatorsEditor.render
 <- AbstractContainerScreen (mixin chestseparators$renderEditorOverlay)
 <- AbstractContainerScreen.extractRenderState

So the driver is writing past the end of the ByteBuffer passed to glReadPixels.

Why it crashes on "random" clicks

EditorRenderer.render calls renderMagnifier every frame while the editor is open, so glReadPixels runs every frame – not only when the magnifier is actually used. Whatever I click last just happens to be the frame where it crashes.

Possible cause (my guess)

The buffer size itself looks right (size*size*4, GL_RGBA / GL_UNSIGNED_BYTE). But the pixel pack state is never set before the read, so if something else (vanilla 26.2 or another mod like Sodium/Iris) left a different state, the driver writes more data than the buffer can hold:

  • GL_PACK_ROW_LENGTH not 0 → driver uses a larger row stride → overflow
  • GL_PACK_SKIP_ROWS / GL_PACK_SKIP_PIXELS not 0
  • a GL_PIXEL_PACK_BUFFER still bound
  • the read happens during extractRenderState (26.2), where the bound read framebuffer isn't guaranteed

Also, Window.getWidth()/getHeight() are used for clamping – the actual framebuffer size can differ from that.

Suggested fix

  • Before glReadPixels: unbind GL_PIXEL_PACK_BUFFER, set GL_PACK_ALIGNMENT = 1 (or 4), GL_PACK_ROW_LENGTH = 0, GL_PACK_SKIP_ROWS = 0, GL_PACK_SKIP_PIXELS = 0 – and restore the old values afterwards
  • Bind the main render target as read framebuffer and use its real size
  • Only read pixels when the magnifier is actually active, not every frame (also better for performance – glReadPixels stalls the GPU)
  • Ideally use Minecraft's own readback API (copy texture to buffer) instead of raw GL calls

Attachments

Activity

  1. DaPiCu commented on Oct 20, 2026

    @DaPiCu
    Author

    Small update: I found the cause and fixed it.

    The crash comes from the two glReadPixels calls (loupe in MagnifierRenderer and eyedropper in ColorPickerGradients). They rely on the current GL pixel-pack state – if another mod leaves e.g. GL_PACK_ROW_LENGTH or a pixel pack buffer bound, the AMD driver writes past the end of the buffer and the JVM dies. That's also why it seemed to crash on "random" clicks: the loupe reads the framebuffer every frame while drawing in the editor.

    I opened a PR with a fix: #8
    It adds a small SafePixelReader that resets (and afterwards restores) the pack state, unbinds any pack buffer and uses the bounds-checked glReadnPixels when available. Nothing else in the mod is changed.

    I've tested the patched build in-game with my full modpack (~124 mods, AMD GPU) – the editor, loupe and eyedropper all work perfectly and the crash is gone.

    Thanks for the mod, it's really useful and fun! 👍 😁

  2. marcsanz-dev commented on Oct 25, 2026

    @marcsanz-dev
    Owner

    Hi @DaPiCu, thank you so much for this report — it's honestly one of the best bug reports I've ever received. The hs_err analysis, the possible causes and even a working PR made it very easy to understand what's going on. 🙏

    You're right that the editor reads the framebuffer with raw glReadPixels for the loupe and the eyedropper, and that it relies on whatever pixel-pack state is current. I really appreciate the fix in #8.

    I won't merge it straight away though: the loupe and eyedropper exist in all 10 versions of the mod, and I want to take this as a chance to review every raw OpenGL call the editor makes, only read pixels when the loupe/eyedropper is actually in use, and test on AMD, NVIDIA and Intel (with Sodium/Iris too), so the fix covers more than this one case. I'll use your PR as the starting point for that.

    The fix will ship in the next big update (2.1.0) for every Minecraft version and loader. I'll keep this issue open and update it when it's out. In the meantime, your patched build is the best workaround if you want to keep using the editor on your AMD card.

    Thanks again, and I'm really glad you're enjoying the mod! 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions