René's URL Explorer Experiment


Title: ByteArrayProxy data corruption due to pointer getting GC'd? · Issue #252 · lmdbjava/lmdbjava · GitHub

Open Graph Title: ByteArrayProxy data corruption due to pointer getting GC'd? · Issue #252 · lmdbjava/lmdbjava

X Title: ByteArrayProxy data corruption due to pointer getting GC'd? · Issue #252 · lmdbjava/lmdbjava

Description: Hey, I've encountered an issue similar to this one: #207 . One key difference is that I use ByteArrayProxy instead of any direct buffers. I'm using the newest lmdbjava along with lmdb binary built from newest version (commit). So I've be...

Open Graph Description: Hey, I've encountered an issue similar to this one: #207 . One key difference is that I use ByteArrayProxy instead of any direct buffers. I'm using the newest lmdbjava along with lmdb binary built ...

X Description: Hey, I've encountered an issue similar to this one: #207 . One key difference is that I use ByteArrayProxy instead of any direct buffers. I'm using the newest lmdbjava along with lmdb binar...

Opengraph URL: https://github.com/lmdbjava/lmdbjava/issues/252

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ByteArrayProxy data corruption due to pointer getting GC'd?","articleBody":"Hey, I've encountered an issue similar to this one: https://github.com/lmdbjava/lmdbjava/issues/207 . One key difference is that I use `ByteArrayProxy` instead of any direct buffers. \n\nI'm using the newest lmdbjava along with lmdb binary built from newest version ([commit](https://github.com/LMDB/lmdb/commit/f20e41de09d97e4461946b7e26ec831d0c24fac7)).\n\nSo I've been following the steps from the mentioned issue and it's true that adding `System.gc()` call right before `mdb_put` makes the bug more frequent. I've been looking at the implementation of the `ByteArrayProxy` and one thing caught my attention. Here's the code from it:\n\n```java\n  @Override\n  protected void in(final byte[] buffer, final Pointer ptr, final long ptrAddr) {\n    final Pointer pointer = MEM_MGR.allocateDirect(buffer.length);\n    pointer.put(0, buffer, 0, buffer.length);\n    ptr.putLong(STRUCT_FIELD_OFFSET_SIZE, buffer.length);\n    ptr.putAddress(STRUCT_FIELD_OFFSET_DATA, pointer.address());\n  }\n\n```\nWhat worries me is that the `pointer`'s underlying memory lifespan is actually longer than the `pointer` reference itself. From my understanding of how `TransientNativeMemory` in `jnr-ffi` works, once a `Pointer` has no reference to it, it's subject to be cleared by the \"cleaner\" thread. So there's a slim chance of `mdb_put` operating on memory that has been cleared already. Am I correct?\n\nWhat I'm currently testing is adding a static list of references to pointers inside the proxy, and then manually clearing it once transaction is done: https://github.com/bdsystems/lmdbjava/commit/9e5eee9926b2cd80efb2235de22a166d71779480 \nSo far this seems to work correctly, but with these kind of issues testing has to take time.\n\nWhat do you think? Could that be the bug, or is my hypothesis wrong? I'm new to java memory management and jnr-ffi in particular so please correct me if my reasoning is faulty.","author":{"url":"https://github.com/oti-dev","@type":"Person","name":"oti-dev"},"datePublished":"2025-03-27T10:30:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/252/lmdbjava/issues/252"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b516e7b7-82c7-36c9-ff57-a91647c58315
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id95EC:2946F1:64018EE:878161C:696E3C14
html-safe-nonce330ecb90f3007839d6c4f8c2b03da6f15d4e916b51db2bc7a83176d7e8305726
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUVDOjI5NDZGMTo2NDAxOEVFOjg3ODE2MUM6Njk2RTNDMTQiLCJ2aXNpdG9yX2lkIjoiODQxMjA3NjIzMTM1NTE1MzQyOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacda14f77212c209809cebb107d1d707203c135488be3ba6d04f90902ebdf4397f
hovercard-subject-tagissue:2952409649
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/lmdbjava/lmdbjava/252/issue_layout
twitter:imagehttps://opengraph.githubassets.com/bdffb639aabadab7fb6a74ace152cb90c5ae0bb420d416c12d4518bcd9780c26/lmdbjava/lmdbjava/issues/252
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/bdffb639aabadab7fb6a74ace152cb90c5ae0bb420d416c12d4518bcd9780c26/lmdbjava/lmdbjava/issues/252
og:image:altHey, I've encountered an issue similar to this one: #207 . One key difference is that I use ByteArrayProxy instead of any direct buffers. I'm using the newest lmdbjava along with lmdb binary built ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameoti-dev
hostnamegithub.com
expected-hostnamegithub.com
Noneb39958d54b39d52b9fc890ff25687d2383a83e003512d4480499b2dbd046839f
turbo-cache-controlno-preview
go-importgithub.com/lmdbjava/lmdbjava git https://github.com/lmdbjava/lmdbjava.git
octolytics-dimension-user_id19765602
octolytics-dimension-user_loginlmdbjava
octolytics-dimension-repository_id60480511
octolytics-dimension-repository_nwolmdbjava/lmdbjava
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id60480511
octolytics-dimension-repository_network_root_nwolmdbjava/lmdbjava
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasefba10be4ea34590240b2f4a625fc807362c2d5b8
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/lmdbjava/lmdbjava/issues/252#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flmdbjava%2Flmdbjava%2Fissues%2F252
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Flmdbjava%2Flmdbjava%2Fissues%2F252
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=lmdbjava%2Flmdbjava
Reloadhttps://github.com/lmdbjava/lmdbjava/issues/252
Reloadhttps://github.com/lmdbjava/lmdbjava/issues/252
Reloadhttps://github.com/lmdbjava/lmdbjava/issues/252
lmdbjava https://github.com/lmdbjava
lmdbjavahttps://github.com/lmdbjava/lmdbjava
Notifications https://github.com/login?return_to=%2Flmdbjava%2Flmdbjava
Fork 124 https://github.com/login?return_to=%2Flmdbjava%2Flmdbjava
Star 866 https://github.com/login?return_to=%2Flmdbjava%2Flmdbjava
Code https://github.com/lmdbjava/lmdbjava
Issues 8 https://github.com/lmdbjava/lmdbjava/issues
Pull requests 1 https://github.com/lmdbjava/lmdbjava/pulls
Actions https://github.com/lmdbjava/lmdbjava/actions
Projects 0 https://github.com/lmdbjava/lmdbjava/projects
Wiki https://github.com/lmdbjava/lmdbjava/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/lmdbjava/lmdbjava/security
Please reload this pagehttps://github.com/lmdbjava/lmdbjava/issues/252
Insights https://github.com/lmdbjava/lmdbjava/pulse
Code https://github.com/lmdbjava/lmdbjava
Issues https://github.com/lmdbjava/lmdbjava/issues
Pull requests https://github.com/lmdbjava/lmdbjava/pulls
Actions https://github.com/lmdbjava/lmdbjava/actions
Projects https://github.com/lmdbjava/lmdbjava/projects
Wiki https://github.com/lmdbjava/lmdbjava/wiki
Security https://github.com/lmdbjava/lmdbjava/security
Insights https://github.com/lmdbjava/lmdbjava/pulse
New issuehttps://github.com/login?return_to=https://github.com/lmdbjava/lmdbjava/issues/252
New issuehttps://github.com/login?return_to=https://github.com/lmdbjava/lmdbjava/issues/252
ByteArrayProxy data corruption due to pointer getting GC'd?https://github.com/lmdbjava/lmdbjava/issues/252#top
https://github.com/bp-alex
bugAn issue relates to behaviour that violates the intention of the libraryhttps://github.com/lmdbjava/lmdbjava/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com/oti-dev
https://github.com/oti-dev
oti-devhttps://github.com/oti-dev
on Mar 27, 2025https://github.com/lmdbjava/lmdbjava/issues/252#issue-2952409649
#207https://github.com/lmdbjava/lmdbjava/issues/207
commithttps://github.com/LMDB/lmdb/commit/f20e41de09d97e4461946b7e26ec831d0c24fac7
bdsystems@9e5eee9https://github.com/bdsystems/lmdbjava/commit/9e5eee9926b2cd80efb2235de22a166d71779480
bp-alexhttps://github.com/bp-alex
bugAn issue relates to behaviour that violates the intention of the libraryhttps://github.com/lmdbjava/lmdbjava/issues?q=state%3Aopen%20label%3A%22bug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.