Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ownership Issue is Inducing Segfault in Example #1

Open
matthewfeickert opened this issue Jul 2, 2017 · 2 comments
Open

Ownership Issue is Inducing Segfault in Example #1

matthewfeickert opened this issue Jul 2, 2017 · 2 comments
Assignees

Comments

@matthewfeickert
Copy link

matthewfeickert commented Jul 2, 2017

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.

@egpbos
Copy link
Member

egpbos commented Jul 4, 2017

@vincecr0ft could this also be related to the too many files opened problem?

@vincecr0ft
Copy link
Member

I think it's possibly related but not the same. Builder.py is built independently of WorkspaceBuilder.ipynb as a philosophical choice. I use notebooks to test algorithms but then refactor them to use in 'real' code. I never use the export to .py function in Jupyter.

I remember testing this as a possible solution to the 'too many files opened' problem but it didn't help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants