diesel: double free or corruption issue when establishing connection

Setup

Versions

  • Rust: 1.75.0
  • Diesel: master
  • Database: Postgres
  • Operating System: Ubuntu

Feature Flags

  • diesel: postgres, r2d2

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?

Getting connection...
Connection gotten
(...)

What is the actual output?

Getting connection...
double free or corruption (out)
core dumped

Are you seeing any additional errors?

no

Steps to reproduce

this is my code, obv snipped but this is the gist

static DB_URL: Lazy<String> = Lazy::new(|| 
    std::env::var("DATABASE_URL").expect("Couldn't get database url")
);
// later
println!("Getting connection...");
let conn = &mut PgConnection::establish(&DB_URL).unwrap(); // core dumped here
println!("Connection gotten");

Checklist

  • I have already looked over the issue tracker and the discussion forum
  • This issue can be reproduced on Rust’s stable channel
  • This issue can be reproduced without requiring a third party crate

About this issue

  • Original URL
  • State: closed
  • Created 5 months ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

Thanks for coming back and leaving that comment here 👍 It’s always helpful to know that the issue is resolved.

@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 diesel which is required for that minimal example, but other crates as well. So you likely want to start with all your dependencies and disable them one by one and see which are relevant.