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

Can trigger segfaults from Python IR interface #226

Open
ezyang opened this issue Sep 13, 2017 · 0 comments
Open

Can trigger segfaults from Python IR interface #226

ezyang opened this issue Sep 13, 2017 · 0 comments

Comments

@ezyang
Copy link
Owner

ezyang commented Sep 13, 2017

As a general rule, it should not be possible to trigger a segfault from Python (unless you're using 'unsafe' APIs). The IR Python bindings do not uphold this property.

(/home/ezyang/local/pytorch/env) [[email protected] ~/local/pytorch] python
Python 3.6.2 |Continuum Analytics, Inc.| (default, Jul 20 2017, 13:51:32) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch._C
>>> g = torch._C.Graph()
>>> n = g.create("Add")
>>> del g
>>> n
Segmentation fault (core dumped)

This particular problem is because inherit C++'s memory management model, where a Node is only live as long as the Graph is live. This is OK in C++, but unacceptable in Python.

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

1 participant