René's URL Explorer Experiment


Title: ByteBuf.nioBuffer() returns a buffer with all zeros · Issue #215 · lmdbjava/lmdbjava · GitHub

Open Graph Title: ByteBuf.nioBuffer() returns a buffer with all zeros · Issue #215 · lmdbjava/lmdbjava

X Title: ByteBuf.nioBuffer() returns a buffer with all zeros · Issue #215 · lmdbjava/lmdbjava

Description: Hi, I'm running into a weird issue where calling nioBuffer on a ByteBuf received from lmdb-java results in a NIO ByteBuffer with the desired size but a value of all zeros. I'm on Netty 4.1.90.Final and lmdbjava 0.8.3 and JDK 19 . The rep...

Open Graph Description: Hi, I'm running into a weird issue where calling nioBuffer on a ByteBuf received from lmdb-java results in a NIO ByteBuffer with the desired size but a value of all zeros. I'm on Netty 4.1.90.Final...

X Description: Hi, I'm running into a weird issue where calling nioBuffer on a ByteBuf received from lmdb-java results in a NIO ByteBuffer with the desired size but a value of all zeros. I'm on Netty 4.1....

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

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ByteBuf.nioBuffer() returns a buffer with all zeros","articleBody":"Hi,\r\n\r\nI'm running into a weird issue where calling `nioBuffer` on a `ByteBuf` received from `lmdb-java` results in a `NIO ByteBuffer` with the desired size but a value of all zeros.\r\n\r\nI'm on `Netty 4.1.90.Final` and `lmdbjava 0.8.3` and JDK 19 . The repro is as follows:\r\n\r\n```\r\npackage foo;\r\n\r\nimport io.netty.buffer.ByteBufUtil;\r\nimport io.netty.buffer.PooledByteBufAllocator;\r\nimport io.netty.buffer.Unpooled;\r\nimport org.junit.jupiter.api.Test;\r\nimport org.junit.jupiter.api.io.TempDir;\r\nimport org.lmdbjava.ByteBufProxy;\r\nimport org.lmdbjava.DbiFlags;\r\nimport org.lmdbjava.Env;\r\n\r\nimport java.io.File;\r\n\r\nimport static java.nio.charset.StandardCharsets.UTF_8;\r\nimport static org.junit.jupiter.api.Assertions.assertNotNull;\r\n\r\npublic class ByteBufMinimalReproTest {\r\n    @TempDir\r\n    File tmp;\r\n\r\n    @Test\r\n    void minimalRepro() {\r\n        var env = Env.create(ByteBufProxy.PROXY_NETTY)\r\n                .setMapSize(10_485_760)\r\n                .setMaxDbs(1)\r\n                .open(tmp);\r\n        var db = env.openDbi(\"testdb\", DbiFlags.MDB_CREATE);\r\n        var alloc = PooledByteBufAllocator.DEFAULT;\r\n\r\n        var key = alloc.directBuffer(env.getMaxKeySize());\r\n        var value = alloc.directBuffer(700);\r\n\r\n        key.writeCharSequence(\"greeting\", UTF_8);\r\n        value.writeCharSequence(\"Hello World\", UTF_8);\r\n\r\n        System.out.println(\"Sanity -- Key\");\r\n        System.out.println(ByteBufUtil.prettyHexDump(key));\r\n        System.out.println(\"Sanity -- Key NIO\");\r\n        System.out.println(ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(key.nioBuffer())));\r\n\r\n        System.out.println(\"Sanity -- Value\");\r\n        System.out.println(ByteBufUtil.prettyHexDump(value));\r\n        System.out.println(\"Sanity -- Value NIO\");\r\n        System.out.println(ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(value.nioBuffer())));\r\n\r\n\r\n        db.put(key, value);\r\n        // need a transaction to read values.\r\n        try (var txn = env.txnRead()) {\r\n            var found = db.get(txn, key);\r\n            assertNotNull(found);\r\n\r\n            System.out.println(\"Found Value\");\r\n            System.out.println(ByteBufUtil.prettyHexDump(found));\r\n            System.out.println(\"Found Value - NIO (Bad: all zeros)\");\r\n            System.out.println(ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(\r\n                    found.nioBuffer())));\r\n\r\n            var fetchedVal = txn.val();\r\n            System.out.println(\"val via txn\");\r\n            System.out.println(ByteBufUtil.prettyHexDump(fetchedVal));\r\n            System.out.println(\"val via txn - NIO (Bad: all zeros)\");\r\n            System.out.println(ByteBufUtil.prettyHexDump(Unpooled.wrappedBuffer(\r\n                    txn.val().nioBuffer())));\r\n        }\r\n        env.close();\r\n    }\r\n}\r\n```\r\n\r\nWhich prints:\r\n\r\n```\r\nSanity -- Key\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 67 72 65 65 74 69 6e 67                         |greeting        |\r\n+--------+-------------------------------------------------+----------------+\r\nSanity -- Key NIO\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 67 72 65 65 74 69 6e 67                         |greeting        |\r\n+--------+-------------------------------------------------+----------------+\r\nSanity -- Value\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 48 65 6c 6c 6f 20 57 6f 72 6c 64                |Hello World     |\r\n+--------+-------------------------------------------------+----------------+\r\nSanity -- Value NIO\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 48 65 6c 6c 6f 20 57 6f 72 6c 64                |Hello World     |\r\n+--------+-------------------------------------------------+----------------+\r\nFound Value\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 48 65 6c 6c 6f 20 57 6f 72 6c 64                |Hello World     |\r\n+--------+-------------------------------------------------+----------------+\r\nFound Value - NIO (Bad: all zeros)\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 00 00 00 00 00 00 00 00 00 00 00                |...........     |\r\n+--------+-------------------------------------------------+----------------+\r\nval via txn\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 48 65 6c 6c 6f 20 57 6f 72 6c 64                |Hello World     |\r\n+--------+-------------------------------------------------+----------------+\r\nval via txn - NIO (Bad: all zeros)\r\n         +-------------------------------------------------+\r\n         |  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f |\r\n+--------+-------------------------------------------------+----------------+\r\n|00000000| 00 00 00 00 00 00 00 00 00 00 00                |...........     |\r\n+--------+-------------------------------------------------+----------------+\r\n```\r\n\r\nMy repro is using the prettyHexDump from ByteBuf, which is why i need to re-wrap nioBuffer.  I'm pretty sure this isn't causing any problems because when I write the bytebuf to file, I see all zeros.\r\n\r\nThe reason I'm doing nioBuffer on this netty buffer is because I need to pass it to Zstd java for decompression.\r\n\r\nI'm new to both lmdb java and netty, and it's possible i'm doing something wrong, but I'd appreciate your help with this.","author":{"url":"https://github.com/kanak","@type":"Person","name":"kanak"},"datePublished":"2023-04-02T17:55:24.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/215/lmdbjava/issues/215"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:b9225884-07b6-1cc0-7041-4882c40595bc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCFEA:EB10B:1C7688B:268A933:69707AE8
html-safe-nonce1041daa94e508e00e656056a085b0585b41796a10a8908af088f7e7384484b20
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRkVBOkVCMTBCOjFDNzY4OEI6MjY4QTkzMzo2OTcwN0FFOCIsInZpc2l0b3JfaWQiOiI5MTk4MzY5NjcyNDg5MTA2MTUyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac9a418ea5fb4749dd8938fe94b16f3df1eb5bf01d7589c9cf05600322960c401e
hovercard-subject-tagissue:1651037139
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/215/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4f220bff1c735983145f1fbbac040cb08f4c65b2a505ae8673be0815a295a128/lmdbjava/lmdbjava/issues/215
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4f220bff1c735983145f1fbbac040cb08f4c65b2a505ae8673be0815a295a128/lmdbjava/lmdbjava/issues/215
og:image:altHi, I'm running into a weird issue where calling nioBuffer on a ByteBuf received from lmdb-java results in a NIO ByteBuffer with the desired size but a value of all zeros. I'm on Netty 4.1.90.Final...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekanak
hostnamegithub.com
expected-hostnamegithub.com
None9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2
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
release7d6181066430cc06553c8396ca201e194ae33cb9
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Flmdbjava%2Flmdbjava%2Fissues%2F215
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://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Flmdbjava%2Flmdbjava%2Fissues%2F215
Sign up https://patch-diff.githubusercontent.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://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215
Reloadhttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215
Reloadhttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215
lmdbjava https://patch-diff.githubusercontent.com/lmdbjava
lmdbjavahttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Flmdbjava%2Flmdbjava
Fork 124 https://patch-diff.githubusercontent.com/login?return_to=%2Flmdbjava%2Flmdbjava
Star 866 https://patch-diff.githubusercontent.com/login?return_to=%2Flmdbjava%2Flmdbjava
Code https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava
Issues 8 https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues
Pull requests 1 https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/pulls
Actions https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/actions
Projects 0 https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/projects
Wiki https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/wiki
Security Uh oh! There was an error while loading. Please reload this page. https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/security
Please reload this pagehttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215
Insights https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/pulse
Code https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava
Issues https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues
Pull requests https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/pulls
Actions https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/actions
Projects https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/projects
Wiki https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/wiki
Security https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/security
Insights https://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/lmdbjava/lmdbjava/issues/215
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/lmdbjava/lmdbjava/issues/215
ByteBuf.nioBuffer() returns a buffer with all zeroshttps://patch-diff.githubusercontent.com/lmdbjava/lmdbjava/issues/215#top
help wantedInvitation to the community to assist with the issuehttps://github.com/lmdbjava/lmdbjava/issues?q=state%3Aopen%20label%3A%22help%20wanted%22
https://github.com/kanak
https://github.com/kanak
kanakhttps://github.com/kanak
on Apr 2, 2023https://github.com/lmdbjava/lmdbjava/issues/215#issue-1651037139
help wantedInvitation to the community to assist with the issuehttps://github.com/lmdbjava/lmdbjava/issues?q=state%3Aopen%20label%3A%22help%20wanted%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.