GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — fix(#261): support heap (address-less) ByteBuf in ByteBufProxy.in() by bernardladenthin · Pull Request #291 · lmdbjava/lmdbjava ConversationAddresses the concrete, reproducible failure behind #261. Root cause (verified)
Netty 4.2's adaptive allocator can hand back heap-backed FixWhen the buffer has no memory address, copy its readable bytes into native scratch ( The reserve variant What this does NOT do (deliberately)It does not touch Tests
Refs #261.
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions…y.in() ByteBufProxy.in() called buffer.memoryAddress() unconditionally, which throws UnsupportedOperationException for any ByteBuf without a native address (hasMemoryAddress()==false) — i.e. any heap buffer. Netty 4.2's adaptive allocator can hand back heap-backed AdaptiveByteBuf instances (e.g. heapBuffer()), so apps on 4.2 hit this; but it is not 4.2-specific — a plain PooledHeapByteBuf fails identically on 4.1. Fix: when the buffer has no memory address, copy its readable bytes into native scratch (MemoryManager.allocateDirect) and point the MDB_val there, returning the Pointer so lmdbjava keeps the scratch reachable for the native call. This mirrors the existing ByteArrayProxy.in() copy path. Direct buffers keep the zero-copy fast path unchanged (in()'s null return). The reserve variant in(buffer, size, ptr) cannot support heap buffers (out() repoints the caller's buffer at LMDB memory via a PooledUnsafeDirectByteBuf field swap, which needs a direct buffer), so it now throws a clear LmdbException instead of an opaque UnsupportedOperationException. Note: this fixes the concrete, reproducible failure in lmdbjava#261. It deliberately does NOT touch allocate()'s exact-class check or out()'s zero-copy field swap; the report's claim that allocate() receives an AdaptiveByteBuf is not reproducible (PROXY_NETTY pins PooledByteBufAllocator, which still yields PooledUnsafeDirectByteBuf on 4.2, and the full suite passes on 4.2). Tests: ByteBufHeapBufferTest (heap value; heap key+value round-trip). Full suite green. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01GdiZ3ABYsVHXBRNCkEizpE
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ReviewersNo reviewsUh oh!
There was an error while loading. Please reload this page. AssigneesNo one assignedLabels
None yet
ProjectsMilestoneNo milestoneDevelopmentSuccessfully merging this pull request may close these issues. Uh oh!
There was an error while loading. Please reload this page. Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later. |
| 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. |