GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Netty 4 IndexOutOfBoundsException due to writer index exceeding buffer capacity · Issue #113 · lmdbjava/lmdbjava

Netty 4 IndexOutOfBoundsException due to writer index exceeding buffer capacity #113

New issue
Copy link
New issue
Copy link
Closed
Closed
Netty 4 IndexOutOfBoundsException due to writer index exceeding buffer capacity#113
Copy link

Description

@bp-alex
bp-alex
opened on Dec 18, 2018
Issue body actions

Netty 4.1.30 and above (plus earlier versions intermittently) fail the following test:

[INFO] Running org.lmdbjava.CursorParamTest
[ERROR] Tests run: 5, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.78 s <<< FAILURE! - in org.lmdbjava.CursorParamTest
[ERROR] execute[4: buffer adapter: org.lmdbjava.CursorParamTest$NettyBufferRunner@68b7bdcb](org.lmdbjava.CursorParamTest)  Time elapsed: 0.015 s  <<< ERROR!
java.lang.IndexOutOfBoundsException: readerIndex: 0, writerIndex: 8 (expected: 0 <= readerIndex <= writerIndex <= capacity(4))
	at io.netty.buffer.AbstractByteBuf.checkIndexBounds(AbstractByteBuf.java:112)
	at io.netty.buffer.AbstractByteBuf.readerIndex(AbstractByteBuf.java:121)
	at org.lmdbjava.ByteBufProxy.out(ByteBufProxy.java:144)
	at org.lmdbjava.ByteBufProxy.out(ByteBufProxy.java:39)
	at org.lmdbjava.KeyVal.valOut(KeyVal.java:133)
	at org.lmdbjava.Cursor.get(Cursor.java:153)
	at org.lmdbjava.CursorParamTest$AbstractBufferRunner.execute(CursorParamTest.java:127)
	at org.lmdbjava.CursorParamTest.execute(CursorParamTest.java:90)

Two issues were identified in ButeBufProxy:

  1. The unsafe setting of the LENGTH_OFFSET was setting the value as a long, whereas the actual field in the Java PooledByteBuf type is an int.
  2. The order of updating the readerIndex before the writerIndex was causing the bounds check on the readerIndex call to fail as the writerIndex had not yet been corrected.

Correction of the above causes tests to pass consistently with Netty 4.1.32 (currently the latest version).

cc #90 #96 #111

Activity

  1. bp-alex
    closed this as completedin 4693eb8on Dec 18, 2018
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.