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

Unable to open project with cloned group nodes (segfault) #568

Closed
josegomezr opened this issue Feb 6, 2021 · 15 comments
Closed

Unable to open project with cloned group nodes (segfault) #568

josegomezr opened this issue Feb 6, 2021 · 15 comments

Comments

@josegomezr
Copy link

josegomezr commented Feb 6, 2021

Hi there,

First of all, congrats for this awesome product 🎉! I enjoyed using it for the first time, watched a couple of Youtube Videos and got straight ahead with some simple results.

I ran into this problem while doing some practicing on my own, I've provided screenshots to replicate it too.

Problem

When using "Clone Nodes" feature, Natron will not be able to open the saved project.

Expected behavior: It should open the project in the last saved state

Actual behavior: Crashes when opening a project with cloned nodes

  • If your problem can be reproduced using a Natron project, please include a link to the project on a file sharing service, or attach the project as a zip file to this issue, if possible.

broken-project.tar.gz

  • If your problem is a crash in an official release/snapshot, please include verbose output from the application
    from a terminal if possible. If you also submitted a crash report, indicate the CrashID if possible.

Unfortunately it just segfaults:

image

Steps to Reproduce

  1. Open a new project
  2. Pull two rectangles + a merge node as such:
    image
  3. Save, Close & Re-open: works as expected. No problem so far.
  4. Group those rectangles + Merge into one node:
    image
  5. Save, Close & Re-open: works as expected. No problem so far.
  6. Clone Group1 and add a Transform & Merge Node (so we can shift it in another direction, just to see the 4 boxes). ex:
    image
  7. Save, Close & Re-open
  8. Crashed.

You may submit a link to any screenshots/videos that can be used to understand how to reproduce the issue.

Versions

  • Natron version/commit (they can be retrieved from the About Window): Natron version 2.3.15 at commit 513a249 on branch tags/v2.3.15

  • OS version: openSUSE Leap 15.2

@devernay
Copy link
Member

devernay commented Feb 6, 2021

Good bug report, thanks! Will look into it when I or Ole-André have time!

@rodlie
Copy link
Contributor

rodlie commented Feb 7, 2021

Engine/Knob.cpp:3513: virtual bool Natron::KnobHelper::slaveToInternal(int, const KnobIPtr&, int, Natron::ValueChangedReasonEnum, bool): Assertion `other.get() != this' failed.

bool
KnobHelper::slaveToInternal(int dimension,
                            const KnobIPtr & other,
                            int otherDimension,
                            ValueChangedReasonEnum reason,
                            bool ignoreMasterPersistence)
{
    assert(other.get() != this);

@josegomezr
Copy link
Author

does that means that assertion is superfluous? or the problem is else where and happens to be caught there? 🤔

@rodlie
Copy link
Contributor

rodlie commented Feb 7, 2021

If I remove the assert we end up in readWriteLock()->lockForRead();

1   QReadWriteLock::lockForRead()                       0x7ffff6a10101 
2   QReadLocker::relock           qreadwritelock.h 111  0x555556eb582f 
3   QReadLocker::QReadLocker      qreadwritelock.h 130  0x555556eb58c2 
4   Natron::KnobHelper::getMaster Knob.cpp         3583 0x5555575baa55 
5   Natron::KnobHelper::getCurve  Knob.cpp         1580 0x5555575b0c4a 
6   Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
7   Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
8   Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
9   Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
10  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
11  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
12  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
13  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
14  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
15  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
16  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
17  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
18  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
19  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
20  Natron::KnobHelper::getCurve  Knob.cpp         1582 0x5555575b0cac 
... <More>                                                             
Loading project: /home/olear/tmp/tuto-1.ntp
Link slave/master for  recenter  failed to restore the following linkage:  Rectangle1_2 
Link slave/master for  recenter  failed to restore the following linkage:  Rectangle1 
Link slave/master for  screenAlpha_separator  failed to restore the following linkage:  Merge1 
Link slave/master for  OutputChannelsA_separator  failed to restore the following linkage:  Merge1 

@josegomezr
Copy link
Author

josegomezr commented Feb 7, 2021

looks like a more complicated issue 😅

Maybe is related on how the XML is built? because the clone node works perfectly in the project, the problem arises when reading the project.

I wish I had Qt expertise to help debugging.

Errata: by XML I mean the XML project file

@rodlie
Copy link
Contributor

rodlie commented Feb 7, 2021

Cloning any group (regardless of what they contain) seems to trigger this.

@rodlie rodlie added the type:bug Something isn't working label Feb 7, 2021
@josegomezr
Copy link
Author

bump! Can I help with this bug? 😅

@rodlie
Copy link
Contributor

rodlie commented Feb 13, 2021

The issue can easily be replicated, so we don't need any additional help on that. I might have some time tomorrow.

@rodlie
Copy link
Contributor

rodlie commented Feb 14, 2021

I have a possible fix, will submit when tested properly.

@devernay
Copy link
Member

See also #579

@devernay
Copy link
Member

devernay commented Mar 9, 2021

@rodlie can you make a PR with the fix?

@devernay devernay self-assigned this Mar 24, 2021
devernay added a commit that referenced this issue Mar 24, 2021
start implementation of the solution to #568, but there's still work to do (search for "#568" in the sources)
@devernay
Copy link
Member

OK I started the work in https://github.com/NatronGitHub/Natron/tree/fix-issue-568

It doesn't crash anymore, but group clones cannot be saved/loaded: links only work within the same group for now.

@devernay devernay changed the title Unable to open project with cloned nodes (segfault) Unable to open project with cloned group nodes (segfault) Mar 25, 2021
devernay added a commit that referenced this issue Mar 28, 2021
Restoring links is now done in two passes:
1. Save the links during deserialization in the KnobI
2. Restore the links once all nodes were created
devernay added a commit that referenced this issue Mar 30, 2021
@devernay
Copy link
Member

I got a solution that works for this situation (see #594), but links/clones are rather fragile. Here's the situation now:

  • saving and loading a project with links/clones should always work (that's the nicest part: you will never lose your work)
  • some operations may fail to undo/redo, and in this case links may be broken, but Natron shouldn't crash
  • some operations may fail to restore links, for example expanding one of the two groups in your situation, or cloning clones...

devernay added a commit that referenced this issue Apr 3, 2021
Restoring links is now done in two passes:
1. Save the links during deserialization in the KnobI
2. Restore the links once all nodes were created
devernay added a commit that referenced this issue Apr 4, 2021
Restoring links is now done in two passes:
1. Save the links during deserialization in the KnobI
2. Restore the links once all nodes were created
@devernay
Copy link
Member

devernay commented Apr 4, 2021

Working on a slightly more backward-compatible solution

@devernay
Copy link
Member

devernay commented Apr 4, 2021

fixed by #598

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

No branches or pull requests

3 participants