Skip to content

Ownership Issue is Inducing Segfault in ExampleΒ #1

@matthewfeickert

Description

@matthewfeickert

I'm sure you've probably already noticed this, but currently there is an ownership issue between ROOT and Python in the WorkspaceBuilder.ipynb code that will cause a segfault after the Jupyter kernel is restarted or if you export the Notebooks to .py and then try to run them. As I have discovered in similar code that I am writing for my own project this can be fixed by telling Python to not take ownership of a ROOT.RooStats.HistFactory object by calling ROOT.SetOwnership(object_name, False) after object creation. For example, after the creation of the first Channel() object in the example section of WorkspaceBuilder.ipynb one would call

chan = ROOT.RooStats.HistFactory.Channel( "Region1" )
ROOT.SetOwnership(chan, False)

It seems that this issue hasn't come up in Builder.py module, as exporting the WorkspaceBuilder.ipynb to .py and commenting out everything except for the lines

import ROOT
ROOT.RooMsgService.instance().setGlobalKillBelow(5
from Builder import get_workspace
workspace = get_workspace(nchannels = 1, events = 1000, nbins = 1)

does NOT result in a segfault and so everything is good to go. So this doesn't seem to be an issue for you in terms of deployment of the code you really care about. However, if you notice in the future that you're getting weird segfaults this may be the issue.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions