Importing FEniCS before TensorFlow causes a crash
I’m working on a library that uses FEniCS and TensorFlow together, and I’m running into an issue where the program crashes if FEniCS is imported before Tensorflow. I can try to avoid the bug by adding some documentation to my library that says that it must be imported before fenics, but it would be nice if the import order didn’t matter.
Based on some googling, I think this is related to exporting symbols with RTLD_GLOBAL. If that is the problem, then TensorFlow says that they have fixed their side of the issue (here https://github.com/tensorflow/tensorflow/issues/13963, https://github.com/tensorflow/tensorflow/issues/13615), but that it might still break if other libraries continue to use RTLD_GLOBAL.
If that’s not the problem, then I can make an issue on TensorFlow’s page, too.
Code to reproduce:
> conda create fenics --name test --no-default-packages -c conda-forge -y -q
> conda activate test
> conda install tensorflow -y -q
> python -c "import tensorflow; import fenics"
> python -c "import fenics; import tensorflow"
[libprotobuf FATAL external/protobuf_archive/src/google/protobuf/stubs/common.cc:68] This program requires version 3.7.0 of the Protocol Buffer runtime library, but the installed version is 3.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.7.0 of the Protocol Buffer runtime library, but the installed version is 3.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "google/protobuf/any.pb.cc".)
Aborted (core dumped)
> conda list protobuf
# packages in environment at /home/gbruer/anaconda3/envs/test:
#
# Name Version Build Channel
libprotobuf 3.7.1 hd408876_0
protobuf 3.7.1 py37he6710b0_0
Comments (2)
-
-
This same issue is also open in the "pyadjoint/dolfin-adjoint" git, because it happens when dolfin-adjoint internally calls TensorFlow:
https://bitbucket.org/dolfin-adjoint/pyadjoint/issues/132/segmentation-fault-using-recent-tensorflow
- Log in to comment
This issue can cause a lot of hard to trace crashes. We weren’t able to run our continuous integration tests that rely on fenics for a while because of this. Is there any interest from the fenics project to address this?