# Executing pyRoot file in subprocess leads to segmentation error

**URL:** <https://root-forum.cern.ch/t/executing-pyroot-file-in-subprocess-leads-to-segmentation-error/62675>\
**Category:** Newbie\
**Created:** [January 16, 2025, 1:38pm UTC](https://root-forum.cern.ch/t/executing-pyroot-file-in-subprocess-leads-to-segmentation-error/62675 "2025-01-16T13:38:11Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![jonas](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/jonas/32/24756_2.png) [@jonas](https://root-forum.cern.ch/u/jonas)\
**Post date:** [January 23, 2025, 6:06am UTC](https://root-forum.cern.ch/t/executing-pyroot-file-in-subprocess-leads-to-segmentation-error/62675/6 "2025-01-23T06:06:41Z")

</div>

Dear @anna98,

thank you so much for sharing the full reproducer!

The problem is a known regression in ROOT 6.34.00 and 6.34.02. We have already seen this in [a different forum post](https://root-forum.cern.ch/t/a-question-about-root/62617/5), and it will be fixed in the next patch release ROOT 6.34.04.

Until that release, you can work around this crash by manually setting the ownership of the cloned histograms:

```diff
diff --git a/python/pixel_analysis.py b/python/pixel_analysis.py
index 40affa2..9e10c40 100644
--- a/python/pixel_analysis.py
+++ b/python/pixel_analysis.py
@@ -103,6 +103,8 @@ def pixel_analysis_threshold(hists, hlabel, canvas):
     hists_without_zero_bin = {}
     for stage in hists.keys():
         hists_without_zero_bin[stage] = [hists[stage][ichip].Clone(hists[stage][ichip].GetName() + '_wo_zerobin') for ichip in range(4)]
+ for h in hists_without_zero_bin[stage]:
+ ROOT.SetOwnership(h, False)

         for ichip in range(4):
             hists_without_zero_bin[stage][ichip].SetBinContent(0, 0)

```

Sorry for the inconvenience!

Cheers,  
Jonas

---

_[View the full topic](https://root-forum.cern.ch/t/executing-pyroot-file-in-subprocess-leads-to-segmentation-error/62675)._
