"Bad file descriptor" on close usually means the descriptor has already been closed. This is often because of a double-close bug in some completely unrelated section of the program.
It can be recreated by running examples in he-transformer/examples ax.py and pyclient.py:
Client:
(venv-tf-py3) $ python $HE_TRANSFORMER/examples/pyclient.py --port 35000
Namespace(hostname='localhost', port=35000)
[WARN] 2020-09-23T14:12:33z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[WARN] 2020-09-23T14:12:33z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[WARN] 2020-09-23T14:12:33z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[INFO] 2020-09-23T14:12:33z src/seal/he_seal_client.cpp 458 Client waiting for results
results [2.999999761581421, 6.0, 9.0, 12.0]
Segmentation fault (core dumped)
Server:
(venv-tf-py3) :~/code/he-transformer/examples$ python $HE_TRANSFORMER/examples/ax.py \
> --backend=HE_SEAL \
> --enable_client=yes \
> --port 35000
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
/home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/build_cmake/venv-tf-py3/lib/python3.6/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
config graph_options {
rewrite_options {
meta_optimizer_iterations: ONE
min_graph_nodes: -1
custom_optimizers {
name: "ngraph-optimizer"
parameter_map {
key: "client_parameter_name:0"
value {
s: "client_input"
}
}
parameter_map {
key: "device_id"
value {
s: ""
}
}
parameter_map {
key: "enable_client"
value {
s: "True"
}
}
parameter_map {
key: "encryption_parameters"
value {
s: ""
}
}
parameter_map {
key: "ngraph_backend"
value {
s: "HE_SEAL"
}
}
parameter_map {
key: "port"
value {
s: "35000"
}
}
}
}
}
2020-09-23 14:12:19.941460: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2200000000 Hz
2020-09-23 14:12:19.943009: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x30509d0 executing computations on platform Host. Devices:
2020-09-23 14:12:19.943056: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): <undefined>, <undefined>
[WARN] 2020-09-23T14:12:19z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[WARN] 2020-09-23T14:12:19z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
2020-09-23 14:12:19.989515: I /home/dockuser/code/he-transformer/build/ext_ngraph_tf/src/ext_ngraph_tf/ngraph_bridge/grappler/ngraph_optimizer.cc:239] NGraph using backend: HE_SEAL
2020-09-23 14:12:20.014063: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
[WARN] 2020-09-23T14:12:20z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[WARN] 2020-09-23T14:12:20z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
[WARN] 2020-09-23T14:12:20z src/seal/seal_util.cpp 39 Parameter selection does not enforce minimum security level
Result: [[ 2.8052179e+17 4.1158964e+17 -4.8061976e+17 -3.6207904e+17]]
Double-close bug: it seems that a socket is closed more than once.
[INFO]2020-09-21T22:37:53z src/aby/aby_client_executor.cpp 149 Client executing circuit took 12370us[INFO]2020-09-21T22:37:53z src/aby/aby_client_executor.cpp 149 Client executing circuit took 13556us[INFO]2020-09-21T22:37:53z src/seal/he_seal_client.cpp 408 Client handling message[INFO]2020-09-21T22:37:53z src/seal/he_seal_client.cpp 225 Client handling result[INFO]2020-09-21T22:37:53z src/tcp/tcp_client.cpp 47 Closing socket [INFO]2020-09-21T22:37:53z src/seal/he_seal_client.cpp 458 Client waiting for results raw results: [-5.89267436e+10 4.44481962e+11 -4.42048643e+11-5.75075647e+11 -1.04892478e+12 5.67507878e+11 7.58654632e+11 -4.30618116e+11 -8.90601275e+11 1.05293565e+12]
[INFO]2020-09-21T22:37:55z src/tcp/tcp_client.cpp 47 Closing socketExceptionoccurred: shutdown: Bad file descriptor Segmentation fault (core dumped)
"Bad file descriptor" on close usually means the descriptor has already been closed. This is often because of a double-close bug in some completely unrelated section of the program.
https://stackoverflow.com/questions/7732726/bad-file-descriptor-closing-boost-socket
It can be recreated by running examples in he-transformer/examples ax.py and pyclient.py: Client:
Server: