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

Segfault with inaccessible custom node #2319

Closed
dbr opened this issue Nov 3, 2017 · 3 comments
Closed

Segfault with inaccessible custom node #2319

dbr opened this issue Nov 3, 2017 · 3 comments

Comments

@dbr
Copy link

dbr commented Nov 3, 2017

If I create a custom node, and register it like this:

class TestInput(Gaffer.ComputeNode):
   pass
IECore.registerRunTimeTyped(TestInput, typeName = "TestInput")

import GafferUI
nodeMenu = GafferUI.NodeMenu.acquire(application)
nodeMenu.append("/Example/TestInput", lambda: TestInput(), searchText = "TestInput")

(just started looking into Gaffer and shoved it in ~/gaffer/startup/gui/example.py as the most obvious place to get code to run)

This works fine when I create the node by calling TestInput() directly (like by clicking the menu item)

However if the node is created "indirectly" (either by saving the node into a .gfr script and loading it, or copypasting the node), the GUI will segfault:

*  1 0x0000003d8200f70f [libpthread.so.0 ] [funlockfile.c : 0]
>> 2 0x00007fbd63a8befc [libGafferBindings.so ] (anonymous namespace) [ScriptNodeBinding.cpp : 0]
*  3 0x00007fbd63a8befc [libGafferBindings.so ] [ScriptNodeBinding.cpp : 0]
*  4 0x00007fbd6401cab5 [libGaffer.so ] Gaffer::ScriptNode::execute(std::string const&, Gaffer::Node*, bool)
*  5 0x00007fbd6401cd70 [libGaffer.so ] Gaffer::ScriptNode::paste(Gaffer::Node*, bool)
[...snip...]

Fix was for me to be less lazy and define the module in a importable Python module, and specify the full path in typeName, e.g define it in blah.py somewhere and do:

IECore.registerRunTimeTyped(TestInput, typeName = "blah::TestInput")

This fixes the problem, but I'd expect a better error in the first case

@dbr
Copy link
Author

dbr commented Nov 3, 2017

Oh, this is with the prebuilt version 0.40.0 binaries on Linux

johnhaddon added a commit to johnhaddon/gaffer that referenced this issue Nov 3, 2017
Classes that didn't exist in any module were creating an empty `import` statement, which was the trigger for the crash described in GafferHQ#2319.
@johnhaddon
Copy link
Member

Thanks for the report, and glad you've got things working. I've fixed the crash in PR #2320 so you'll now get a slightly more informative error - NameError: name 'TestInput' is not defined.

@dbr
Copy link
Author

dbr commented Nov 8, 2017

Thanks! That error looks far more descriptive \o/

andrewkaufman pushed a commit to andrewkaufman/gaffer that referenced this issue Feb 16, 2018
If parsing fails, a null module is returned, so we must check for it.

Fixes GafferHQ#2319.
andrewkaufman pushed a commit to andrewkaufman/gaffer that referenced this issue Feb 16, 2018
Classes that didn't exist in any module were creating an empty `import` statement, which was the trigger for the crash described in GafferHQ#2319.
andrewkaufman pushed a commit to andrewkaufman/gaffer that referenced this issue Feb 21, 2018
If parsing fails, a null module is returned, so we must check for it.

Fixes GafferHQ#2319.
andrewkaufman pushed a commit to andrewkaufman/gaffer that referenced this issue Feb 21, 2018
Classes that didn't exist in any module were creating an empty `import` statement, which was the trigger for the crash described in GafferHQ#2319.
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

2 participants