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

Importing tensorflow causes a crash on exit #1073

Closed
rmarru opened this issue Jul 30, 2020 · 1 comment · Fixed by #1355
Closed

Importing tensorflow causes a crash on exit #1073

rmarru opened this issue Jul 30, 2020 · 1 comment · Fixed by #1355
Labels

Comments

@rmarru
Copy link

rmarru commented Jul 30, 2020

🐛 Bug Reports

🌍 Environment

  • Your operating system and version: Ubuntu 18.04.4 LTS (Bionic Beaver)
  • Your python version: Python 3.7.8
  • How did you install python (e.g. apt or pyenv)? Did you use a virtualenv?: Installed via apt. No virtualenv.
  • Your Rust version (rustc --version): 1.45.0
  • Your PyO3 version: 0.11.1
  • Have you tried using latest PyO3 master (replace version = "0.x.y" with git = "https://github.com/PyO3/pyo3")?: Yes

💥 Reproducing

Tensorflow version: 2.1.0, installed via pip: pip3 install tensorflow==2.1.0

Minimal reproduction:

use pyo3::prelude::*;

fn main() {
    let gil = Python::acquire_gil();
    let py = gil.python();

    let _mod = PyModule::import(py, "tensorflow").unwrap();
}

On exit:

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
          Running `target/debug/pyo3`
corrupted double-linked list
[1]    4387 abort      cargo run

or

$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
          Running `target/debug/pyo3`
corrupted size vs. prev_size
[1]    5299 abort      cargo run

Running import tensorflow directly in python (and exiting the interpreter) exits normally.

Looks like a similar issue to Importing mxnet causes a segfault on exit #1044.

If I comment out libc::atexit(finalize) as @kngwyu suggested in comment, the error does not happen and the process exits successfully.

@davidhewitt
Copy link
Member

#1355 has now merged - we decided to disable finalizing by default because as we see it can lead to weird crashes like this.

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

Successfully merging a pull request may close this issue.

2 participants