Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last byte of string value is replaced by zero byte #40

Closed
aikoven opened this issue Apr 1, 2020 · 4 comments
Closed

Last byte of string value is replaced by zero byte #40

aikoven opened this issue Apr 1, 2020 · 4 comments

Comments

@aikoven
Copy link

aikoven commented Apr 1, 2020

This started happening after updating to 0.10.4. I narrowed it down to a set of commands in Node REPL:

> const  fdb = require('foundationdb')
> fdb.setAPIVersion(600)
undefined
> db = fdb.openSync()
> db.set('key', '123')
Promise { <pending> }
> db.get('key').then(console.log)
Promise { <pending> }
> <Buffer 31 32 00>

It can be seen that the last byte became 00.

This doesn't happen if I pass Buffer.from('123') to the set() call.

@josephg
Copy link
Owner

josephg commented Apr 1, 2020

Yikes thats really bad, and supports what I was saying here that we need to either remove the second code path (using strings) or add much more testing for it. Thanks for the report - I'll fix & publish an updated version now.

@josephg josephg closed this as completed in 1c4109b Apr 1, 2020
@josephg
Copy link
Owner

josephg commented Apr 1, 2020

... The silver lining is that that test code would have crashed in 0.10.3 due to the Assertion failed: (owned == false) issue. Hopefully 0.10.4 is recent enough that nobody is using non-prefixed databases with string keys in production. (It wouldn't have worked at all with 0.10.3).

@josephg
Copy link
Owner

josephg commented Apr 1, 2020

📦 foundationdb@0.10.6

@aikoven
Copy link
Author

aikoven commented Apr 2, 2020

Yep, we updated to 0.10.4 because we started to experience these crashes. Haven't pushed it to production.

Thanks for the quick response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants