# Exception silently catched by Jupyter ROOT kernel

**URL:** <https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179>\
**Category:** ROOT\
**Tags:** python, cling\
**Created:** [February 27, 2020, 5:28pm UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179 "2020-02-27T17:28:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgras](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pgras/32/21897_2.png) [@pgras](https://root-forum.cern.ch/u/pgras)\
**Post date:** [February 27, 2020, 5:28pm UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/1 "2020-02-27T17:28:02Z")

</div>

Hello,

when executing the following code in Jupyter, an exception is silently caught by the ROOT kernel and the code ends with a segmentation fault. When running the same code from the ROOT application, the message of the caught exception is displayed, as you can see in the transcript of the code execution below.

* * *

root [0] ROOT::RDataFrame rd(10);  
root [1] h = \*rd.Histo1D(“foo”);  
Error in TRint::HandleTermInput(): std::runtime\_error caught: Unknown column: foo  
root [2] h.Draw()

\*\*\* Break \*\*\* segmentation violation

[stack backtrace…]

* * *

Without the exception message it’s difficult to identify the problem is less trivial similar cases, where the user made a typo in the column name.

I’ve attached the screenshot of the code execution in Jupyter,

![catched_exception_jupyter](https://root-forum.cern.ch/uploads/default/original/3X/9/2/9266807ae5cb63c28898c516f3ec29545b2e87b2.png)

Is there an option to enable the display of the exception error or to disable the catching ?

Let me know if I should open a JIRA bug report: I see two problems: the message that is not displayed and the undefined state of the variable h, that leads to a segmentation violation later in the code.

I’ve tested the code snippet with ROOT built on Debian from the git tag v6-19-02 for both root application and Jupyter and also for Jupyter with the ROOT release currently used by SWAN (6.18/00). I will test it with 6.20.00 as soon I have installed it.

Philippe.

---

<div class="post-metadata">

**Author:** ![etejedor](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/e/e79b87/32.png) [@etejedor](https://root-forum.cern.ch/u/etejedor)\
**Post date:** [February 28, 2020, 8:57am UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/2 "2020-02-28T08:57:37Z")

</div>

Hi Philippe,

Yes, this is a problem of the Jupyter kernel for ROOT C++. It looks like the Python side of the kernel fails to capture the error from the C++ side (there is an I/O handler for this). Please feel free to open a ticket.

Regarding the RDataFrame part, there should be an error saying that `foo` is not a column of your dataset. I understand this is not the case? Then I would open another ticket for this one too.

Enric

---

<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:** [February 28, 2020, 9:29am UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/3 "2020-02-28T09:29:19Z")

</div>

Hi,  
note that RDataFrame does throw an exception:

```cpp
root [0] ROOT::RDataFrame df(10);
root [1] auto h = df.Histo1D("foo");
Error in <TRint::HandleTermInput()>: std::runtime_error caught: Unknown column: foo

```

This seems to be an issue in the ROOT interpreter where a shared\_ptr temporary causes a segfault:

```cpp
// this is on lxplus sourcing /cvmfs/sft.cern.ch/lcg/views/LCG_96python3/x86_64-centos7-gcc8-opt/setup.sh
root [2] df.Histo1D("foo");

 ***Break*** segmentation violation

===========================================================
There was a crash.
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f3f0962141c in waitpid () from /lib64/libc.so.6
#1 0x00007f3f0959ef12 in do_system () from /lib64/libc.so.6
#2 0x00007f3f0a725d03 in TUnixSystem::StackTrace() () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.18.00-885ca/x86_64-centos7-gcc8-opt/lib/libCore.so
#3 0x00007f3f0a7285d4 in TUnixSystem::DispatchSignals(ESignals) () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.18.00-885ca/x86_64-centos7-gcc8-opt/lib/libCore.so
#4 <signal handler called>
#5 0x00007f3f04d30577 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() () from /cvmfs/sft.cern.ch/lcg/releases/ROOT/6.18.00-885ca/x86_64-centos7-gcc8-opt/lib/libCling.so
#6 0x00007f3f0aec64ed in ?? ()
#7 0x00000000026bd130 in ?? ()
#8 0x00000000026bd130 in ?? ()
#9 0x00007ffd8c1429c0 in ?? ()
#10 0x00007f3f0aec64ac in ?? ()
#11 0x00000000018a3910 in ?? ()
#12 0x00000000026bd130 in ?? ()
#13 0x00007ffd8c1429e0 in ?? ()
#14 0x00007f3f0aec1620 in ?? ()
#15 0x0000000000000000 in ?? ()
===========================================================

```

@Axel, what do you make of this?

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![pgras](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pgras/32/21897_2.png) [@pgras](https://root-forum.cern.ch/u/pgras)\
**Post date:** [February 28, 2020, 9:57am UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/4 "2020-02-28T09:57:56Z")

</div>

` Indeed the error message is displayed when running from the ROOT application, it's only on Jupyter that it is not. Nevertheless, in both case we have a segmentation fault in the next statement.`

---

<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:** [February 28, 2020, 10:23am UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/5 "2020-02-28T10:23:26Z")

</div>

Yes, my guess would be that due to the crash the exception is not propagated correctly.

---

<div class="post-metadata">

**Author:** ![pgras](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pgras/32/21897_2.png) [@pgras](https://root-forum.cern.ch/u/pgras)\
**Post date:** [February 28, 2020, 1:33pm UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/6 "2020-02-28T13:33:33Z")

</div>

JIRA tickets created: [ROOT-10590](https://sft.its.cern.ch/jira/browse/ROOT-10590) and [ROOT-10589](https://sft.its.cern.ch/jira/browse/ROOT-10589).

---

<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:** [March 13, 2020, 1:33pm UTC](https://root-forum.cern.ch/t/exception-silently-catched-by-jupyter-root-kernel/38179/7 "2020-03-13T13:33:39Z")

</div>

Closed on March 13, 2020, 1:33pm UTC

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