diesel: Intermittent segfault on program exit
I’m getting an intermittent seg fault on program exit in something to do with a Postgres db connection in some scheduled-thread-pool thread.
Setup
Versions
- Rust: rustc 1.65.0 (897e37553 2022-11-02)
- Diesel: 2.0.2
- Database: (PostgreSQL) 15.1 (Ubuntu 15.1-1.pgdg20.04+1)
- Operating System Ubuntu 20.04 5.15.0-56-generic
Feature Flags
- diesel: diesel = { version=“2.0.2”, features=[“postgres”,“r2d2”,“uuid”,“chrono”] }
Problem Description
Seg fault in scheduled-thread-pool in some connection run() method. I’m working on creating a less intermittent reproduction that I can share.
What are you trying to accomplish?
What is the expected output?
What is the actual output?
Are you seeing any additional errors?
Steps to reproduce
git clone https://github.com/eloff/diesel-segfault cargo run repeat until segfault
Checklist
- I have already looked over the issue tracker and the disussion forum for similar possible closed issues.
- This issue can be reproduced on Rust’s stable channel. (Your issue will be closed if this is not the case)
- This issue can be reproduced without requiring a third party crate
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (11 by maintainers)
Fair enough, I think if others have this problem, they’ll find this github issue and can follow the same step to resolve it (add openssl as explicit dependency, call openssl::init() at the top of main()).
Okay I’ll work on an MVR
Just wanted to post here and note that we’ve been experiencing this issue as an intermittent failure in our integration tests for months. Just today, we isolated it to Diesel… then discovered this issue. @eloff I will buy you a drink if you are ever passing through NYC.
As an additional data point, we use MySQL—we’ve never experienced it in our production Docker container (based on
debian:bullseye-slim), but we reproduced in both GitHub’s hosted ubuntu image and on local Windows and MacOS machines.Thank you again 🙏🏼 Cheers!
I’m happy to hear that you figured out a solution for this problem 👍 .
I don’t think it would be a good idea to add an explicit call to
openssl::initto diesel, because of:libpqinternally initializes opennsl on it’s own if we do not call one of the listed functions (which diesel does not call).I would like to close this issue as environment specific issue.