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 — Fix resulting buffer from BufferProxy's out method being ignored. by LambdAurora · Pull Request #255 · lmdbjava/lmdbjava

Conversation

@LambdAurora

@LambdAurora LambdAurora commented Jul 9, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

This pull request aims to fix some cases in LMDBJava where the BufferProxy's out method resulting buffer is ignored, especially in Dbi.

I've discovered this issue while attempting to write a new implementation of BufferProxy to use Java 22's Function Foreign Memory API in preparation of Java 25's depreciation of various methods in Unsafe invalidating most fast BufferProxy implementations. The implementation failed to pass some tests since in the out method I returned a new ByteBuffer (taking advantage of MemorySegment.ofAddress().asByteBuffer()).

After further investigation, I've found that ByteArrayProxy also relies on returning a different "buffer" from the one that's given as an argument, for which I've added new tests that reproduce the behavior of DbiTest.customComparator and DbiTest.dbiWithComparatorThreadSafety using byte arrays instead. ByteArrayProxy led me to think that returning a different buffer in out is an allowed and intended behavior.

This fix is important for users of ByteArrayProxy and allows for a stop-gap external implementation of BufferProxy using the FFM API to allow users to upgrade to Java 25 when the time comes until a proper resolution to #42 comes around.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
LambdAurora added 2 commits July 8, 2025 18:10
@LambdAurora
Fix comparator lost buffer ref from proxy in Dbi.
ddca4bd
TODO: address failing dbiWithComparatorThreadSafetyByteArray test.
@LambdAurora
Use ByteBuffer for int serialization into bytes.
236b7c9
This proves to be more reliable than Agreno's UnsafeBuffers.
@at055612 at055612 mentioned this pull request Oct 24, 2025
Java 25, the Foreign Function & Memory API and removal of Unsafe #259
Open
@at055612

at055612 commented Oct 24, 2025

Copy link
Copy Markdown
Collaborator

Regarding the upgrade to Java 25, see #259

I will however try and verify and merge this PR as soon as possible.

LambdAurora reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bp-alex bp-alex mentioned this pull request Oct 24, 2025
Replace Unsafe and illegal reflection operations #42
Closed
@bp-alex
bp-alex force-pushed the master branch 2 times, most recently from 5e03aec to e598e21 Compare October 25, 2025 04:27
@at055612
Merge branch 'master' into fix/bufferproxy_out_ignored
f0b9c56
@codecov

codecov Bot commented Oct 26, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.33%. Comparing base (0b741e8) to head (58a489f).

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #255      +/-   ##
============================================
+ Coverage     88.60%   89.33%   +0.72%     
- Complexity      409      413       +4     
============================================
  Files            32       32              
  Lines          1483     1481       -2     
  Branches        124      124              
============================================
+ Hits           1314     1323       +9     
+ Misses          100       88      -12     
- Partials         69       70       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@at055612
Fix accidental change to import order
58a489f
@at055612
at055612 merged commit 43ac84f into lmdbjava:master Oct 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@LambdAurora @at055612
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.