# Segmentation Fault in binFHE serial example

**URL:** <https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231>\
**Category:** Library Questions\
**Created:** [November 21, 2022, 6:25pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231 "2022-11-21T18:25:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kvgarimella](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kvgarimella](https://openfhe.discourse.group/u/kvgarimella)\
**Post date:** [November 21, 2022, 6:25pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/1 "2022-11-21T18:25:51Z")

</div>

Hello,

I have built openFHE on my system and I am trying to run the example: `./build/bin/examples/binfhe/boolean-serial-binary`. However, I am getting a Segmentation Fault once the actual computation on the ciphertext begins.

Here is the output of the above command:

```auto
Generating keys.
Done generating all keys.
The cryptocontext has been serialized.
The refreshing key has been serialized.
The key switching key has been serialized.
The secret key sk1 key been serialized.
A ciphertext has been serialized.
The cryptocontext has been deserialized.
The refresh key has been deserialized.
The switching key has been deserialized.
The secret key has been deserialized.
The ciphertext has been deserialized.
Segmentation fault (core dumped)

```

Any help would be appreciated! Thanks!

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [November 21, 2022, 7:13pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/2 "2022-11-21T19:13:38Z")

</div>

Can you give us additional information? Like your OS, what version of OpenFHE are you on (dev/release), what your compiler version is, etc.

Thanks

---

<div class="post-metadata">

**Author:** ![kvgarimella](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kvgarimella](https://openfhe.discourse.group/u/kvgarimella)\
**Post date:** [November 22, 2022, 4:07pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/3 "2022-11-22T16:07:13Z")

</div>

OS: Ubuntu 20.04.4 LTS. I cloned the repo so we are using the main branch and followed the instructions in the documentation: [Installing OpenFHE on Linux — OpenFHE documentation](https://openfhe-development.readthedocs.io/en/latest/sphinx_rsts/intro/installation/linux.html)

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [November 22, 2022, 5:40pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/4 "2022-11-22T17:40:11Z")

</div>

Also, how much memory does your system have. Serialization/Deserialization are not very memory efficient (though BinFHE has somewhat smaller memory requirements), and if you run out of system memory, you can segfault.

---

<div class="post-metadata">

**Author:** ![kvgarimella](https://avatars.discourse-cdn.com/v4/letter/k/87869e/32.png) [@kvgarimella](https://openfhe.discourse.group/u/kvgarimella)\
**Post date:** [November 22, 2022, 5:48pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/5 "2022-11-22T17:48:01Z")

</div>

Thanks, I will track the memory consumption while running the examples. We are running this on a server with ~250 GB RAM.

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [November 22, 2022, 6:28pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/6 "2022-11-22T18:28:41Z")

</div>

Then memory consumption is not a problem. Sometimes people try to run on 4GB laptops etc.  
Usually anything \>=32 GB is not a problem.

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [November 22, 2022, 6:47pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/7 "2022-11-22T18:47:30Z")

</div>

@ypolyakov have duplicated this error on my system. Am investigating,  
it fails on the initial Encrypt() after deserialization.

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [November 22, 2022, 6:58pm UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/8 "2022-11-22T18:58:09Z")

</div>

Can you please open a issue on this topic. It appears there is a problem with the example.

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [November 24, 2022, 12:18am UTC](https://openfhe.discourse.group/t/segmentation-fault-in-binfhe-serial-example/231/9 "2022-11-24T00:18:04Z")

</div>

More details about the bug are provided in [Segmentation Fault in binFHE serial examples · Issue #239 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/issues/239) The bug will soon be resolved.
