# Segmentation violation with boolean column

**URL:** <https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941>\
**Category:** ROOT\
**Tags:** bug, rdataframe\
**Created:** [June 16, 2020, 6:47pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941 "2020-06-16T18:47:36Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [June 16, 2020, 6:47pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/1 "2020-06-16T18:47:36Z")

</div>

I have a TTree with a branch of type `bool`. If I create an `RDataFrame` and try to filter on it, I get a segmentation violation _unless_ I first create a Display. Why should this be? Reproducer follows.

* * *

The following reproducer uses the attached [test.root](https://root-forum.cern.ch/uploads/short-url/tZgTi4GU28o6xdlTdORAX2S2BaY.root) (5.3 KB).

Filtering on the boolean column`'mycol'` produces a segmentation violation (output attached as [fail.txt](https://root-forum.cern.ch/uploads/short-url/hKClmSwr4PlgBlM37m65VCUKw65.txt) (21.4 KB)):

```python
import ROOT as r
rdf = r.RDataFrame('test', 'test.root')
frdf = rdf.Filter('mycol')
c = frdf.Count()
print(c.GetValue())

```

If, however, I first create a `Display` of the filtered `RDataFrame`, I have no problems (output reads “`1`”):

```python
import ROOT as r
rdf = r.RDataFrame('test', 'test.root')
frdf = rdf.Filter('mycol')
disp = frdf.Display('mycol') # additional command
c = frdf.Count()
print(c.GetValue())

```

* * *

_ROOT Version:_ 6.20/04  
_Platform:_ linux  
_Compiler:_ [Conda Forge]

* * *

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 16, 2020, 8:20pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/2 "2020-06-16T20:20:21Z")

</div>

Thank you for the simple and self-contained reproducer.

I cannot reproduce the issue with local ROOT build, with LCG\_97 on lxplus nor with the system ROOT installation on lxplus.

A conda environment works fine if I start a fresh shell and activated it.

I can only reproduce the crash if _first_ I run `source my/root/build/bin/thisroot.sh` and _then_ I activate a conda environment with ROOT.

Is it the same for you?  
Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [June 16, 2020, 8:58pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/3 "2020-06-16T20:58:52Z")

</div>

Hm it may be something like that.

Summary:  
No problem seen on:

- my own machine (macOS, python 2.7, master built against anaconda)
- lxplus vanilla environment for LHCb (6.20/04, python 2.7)

Problem seen on:

- conda environment on lxplus (python 3.8.3 from conda-forge, root\_base=6.20.04)

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 16, 2020, 9:01pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/4 "2020-06-16T21:01:29Z")

</div>

> [@mwilkins](#):
>
> conda environment on lxplus

…which has a system installation of ROOT as well, that might be causing an interference similar to my `source thisroot.sh; conda activate root-env`. 🤔

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 16, 2020, 9:07pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/5 "2020-06-16T21:07:37Z")

</div>

Your `fail.txt` file shows most of the stacks are in `/afs/cern.ch/user/m/mwilkins/miniconda/envs/HcHc_ana/lib/libCling.so` but one is in `/home/conda/feedstock_root/build_artifacts/python_1591030388223`.

Are those two completely different ROOT installations of yours?

EDIT: no, `/home/conda` comes from the conda build itself 🤔

---

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [June 16, 2020, 9:14pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/6 "2020-06-16T21:14:39Z")

</div>

Indeed, it looks like your hypothesis is correct, that somehow different versions of ROOT are interfering with each other. I am not sure how to prevent this on lxplus; this doesn’t seem to be a problem with ROOT, per se, however–I will ask around.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [June 16, 2020, 9:25pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/7 "2020-06-16T21:25:15Z")

</div>

It might also be that the conda build can do something to avoid the interference. @chrisburr might have an idea 😃

---

<div class="post-metadata">

**Author:** ![chrisburr](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/chrisburr/32/18272_2.png) [@chrisburr](https://root-forum.cern.ch/u/chrisburr)\
**Post date:** [June 17, 2020, 6:34am UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/8 "2020-06-17T06:34:55Z")

</div>

As @eguiraud’s edit mentions, the `/home/conda/feedstock_root/build_artifacts/python_1591030388223` path is just a reflection of where Python was built. You see similar things with LCG builds showing paths from their Jenkins infrastructure.

I’ve tried your reproducer and it does I see the segfault with 6.18.04, 6.20.4 and 6.20.6 on Linux, even on my local machine which doesn’t have a system installation. There is no segfault on macOS or the newly released 6.22.0.

@mwilkins Would it be possible for you to update to 6.22.0? (LHCb specific addition: I will update the lb-conda default environment later today if you want to try it instead of reinstalling on AFS)

---

<div class="post-metadata">

**Author:** ![mwilkins](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/mwilkins/32/28332_2.png) [@mwilkins](https://root-forum.cern.ch/u/mwilkins)\
**Post date:** [June 17, 2020, 12:59pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/9 "2020-06-17T12:59:56Z")

</div>

Can confirm, there is no problem in 6.22. What a strange behavior. Thanks for your help.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 1, 2020, 12:59pm UTC](https://root-forum.cern.ch/t/segmentation-violation-with-boolean-column/39941/10 "2020-07-01T12:59:57Z")

</div>

Closed on July 1, 2020, 12:59pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
