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
Bug with binay protocol and arrays #19669
Comments
Hey @tlvenn, thanks for the bug report! It does look like there's an issue on our end regarding the binary protocol for arrays, I'll investigate and get back to you. |
Thanks for the reply @justinj The 'interesting' part is that sometimes it works... |
@tlvenn the crash in |
@justinj any update on this issue ? Thanks a lot in advance ! |
Hey @tlvenn, sorry, have had a lot on my plate but I'm looking into this now! Can you give me any info on what the queries you were using looked like? |
Hi @justinj, it's a pretty trivial one:
With the following schema:
|
hey @tlvenn, I spent some time with some other drivers that support the binary format, I tried node-postgres, libpq, and pgx (here's a reconstruction of your schema in pgx) but they all seemed to work ok, can you give me any more info on
|
Hi @justinj I somehow missed your feedback, sorry about that. Right now my usage of arrays is minimal, I use it only in one table which happens to be loaded in full when the application starts. And yes it works 9 times out of 10. I will try to check against Postgres and report back. |
Ha great to hear @justinj 🎉 |
Release notes: fix issue with stale buffer data when using the binary format for arrays. Fixes cockroachdb#20372. Fixes cockroachdb#19669. This commit fixes an issue involving passing a bytes.Buffer by value which would cause old buffered data for arrays to be re-used. The bug here was somewhat subtle and had to do with copying a bytes.Buffer by value whose slice header pointed to its fixed-size array used for small allocations, and then *re-assigning* the original buffer, causing the fixed-size array to be overwritten and the buffered value changed. A reduced version of the issue can be seen here: https://play.golang.org/p/4-v_AeqYtR
Release notes: fix issue with stale buffer data when using the binary format for arrays. Fixes cockroachdb#20372. Fixes cockroachdb#19669. This commit fixes an issue involving passing a bytes.Buffer by value which would cause old buffered data for arrays to be re-used. The bug here was somewhat subtle and had to do with copying a bytes.Buffer by value whose slice header pointed to its fixed-size array used for small allocations, and then *re-assigning* the original buffer, causing the fixed-size array to be overwritten and the buffered value changed. A reduced version of the issue can be seen here: https://play.golang.org/p/4-v_AeqYtR
Release notes: fix issue with stale buffer data when using the binary format for arrays. Fixes cockroachdb#20372. Fixes cockroachdb#19669. This commit fixes an issue involving passing a bytes.Buffer by value which would cause old buffered data for arrays to be re-used. The bug here was somewhat subtle and had to do with copying a bytes.Buffer by value whose slice header pointed to its fixed-size array used for small allocations, and then *re-assigning* the original buffer, causing the fixed-size array to be overwritten and the buffered value changed. A reduced version of the issue can be seen here: https://play.golang.org/p/4-v_AeqYtR
I am using the following CDB version:
Since 1.1 is now supporting arrays, I decided to start using them in my project. I use basic arrays, mainly integer arrays which is what is causing the below issue.
Here is the error that Postgrex (Elixir postgresql driver) is reporting:
Postgrex unlike many other drivers is leveraging the binary protocol and not the text protocol. We saw some errors like that in the past that @fishcakez identified and helped troubleshoot. I suspect something similar is happening with arrays.
@fishcakez, do you have any idea what is going on ?
The text was updated successfully, but these errors were encountered: