-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
double free or corruption issue when establishing connection #3930
Comments
Thanks for opening this bug report. This kind of issue is highly depending on your environment, therefore I need to ask for a few more details:
Additionally it would be very helpful to have a stack trace of the crash recorded by gdb or a similar debugger. It would be even more helpful to have a self contained example based on a docker image that reproduces the issue. |
|
it says r2d2 worker but i'm not pooling the connections through r2d2, it might just be the feature flag doing that or something im not sure |
Thanks for adding these information. Can you use the |
woops sorry, yeah here
|
i guess its definitely caused by libpq then, not entirely sure how to fix it tho |
Thanks for providing this backtrace. That's helpful. I'm able to reproduce this issue locally by using #3910 in a ubuntu 22.04 docker container. I'm currently looking into what is causing this. |
I found Homebrew/homebrew-core#155651 and related https://www.postgresql.org/message-id/flat/4036729.1701130863%40sss.pgh.pa.us#7a1940670114e88862049b03fc61df4f. That is also what is causing #3910 to fail. Pulling in the relevant postgres commit seems to fix that issue for me. Therefore can you check whether you link openssl 3.2.0 statically (e.g. via the |
Just pitching in here. I have the exact same issue on a Debian docker-image. Diesel config: I'm not statically linking anything myself. I'm just using the libraries installed on the machine. I don't really understand how you fixed it @weiznich - Could you provide some more details on how you did it? |
@madser123 Can you provide an self contained reproducing example in a docker file? That would be really helpful. The fix above essentially just pulls in version 16.2 of libpq as that fixes a potential segfault around their interaction with openssl. |
I will try, and return to you. Thank you for helping :) |
@weiznich Just FYI - In my attempts to create a self contained reproduction of this, it somehow works as expected. I will experiment further and reply back here, if i find something. Thank you for the interest :) |
@madser123 I just remember that at some point we got similar reports and they were solved back then by removing other dependencies. So it might be that it's not just |
I have some weird finding (At least to me). It seems to be a trait from one of my own libraries.... And i don't really get why. I will try to explain here. Here is the binary project itself:
main.rs:
As seen in the above code, when importing the Interaction trait from my "bolt-rs" crate, it results in the However, this is all the trait does (And it's not even relevant for any of the types in the project):
And then the trait is implemented for a bunch of internal types to the bolt-rs crate. The cargo.toml for the bolt-rs project looks like so:
Now. I understand that the trait will compile some other code, but... Appending the imports used in the Cargo.toml for the bolt-rs project (And adding a use statement for the I fail to see what the difference in this is, and how it can cause the error.. Diesel and rocket-sync-db-pools are the only "new" crates to all of this - Bolt-rs and everything else has been running fine until now (Not to say that these can't be the error). Do you have any idea on how i can proceed from here or maybe some clarity as to how/why this can happen? |
Okay - Figured out originates in the library where i'm using diesel. I'm able to replicate it there. I will try pulling dependencies again... |
@weiznich it was openssl that was imported in the library using the Vendored feature - It was some legacy stuff from when we tried to get the binary working on MUSL images - Sorry for the inconvenience, but thank you for the help! |
Thanks for coming back and leaving that comment here 👍 It's always helpful to know that the issue is resolved. |
I'm closing this issue now as a upstream libpq issue with recent openssl versions (>= 3.2). It's fixed in libpq 16.2. For any future person that encounters this issue again, please double check:
Please carefully check where these dependencies are loaded from, as your rust dependency tree might link one or the other dependency statically or your runtime system might provide different versions than used at compile time. If you answer one of these questions above with "Yes" you need adjust one of these dependencies to a compatible version. |
Setup
Versions
Feature Flags
Problem description / What are you trying to accomplish?
i'm simply trying to establish a connection to postgres on ubuntu using diesel. everything works fine when i'm on windows, but the moment i switch to ubuntu (either through wsl or my vps) it errors on trying to establish this connection. since it's a c issue i guess it could be a postgres issue but i'm not entirely sure - either way this ONLY occurs when i'm doing it through ubuntu
i should mention that although i have the r2d2 feature flag, it doesn't work whether or i'm using r2d2 or not (so it's not bc of r2d2)
What is the expected output?
What is the actual output?
Are you seeing any additional errors?
no
Steps to reproduce
this is my code, obv snipped but this is the gist
Checklist
The text was updated successfully, but these errors were encountered: