ID 335084 - Nuke will throw bounding box exception when cancelling frames during a render with a LensDistortion1 node

Follow

Problem summary
When a LensDistortion1 (Legacy) Node is used within a Nuke script, If the user has a 'Before frame render' callback that is is calling a 'nuke.cancel()' function within to cancel a current frame render, Nuke will exit and throw an exception.

Exception thrown:

 

Users have also faced segfaults from this when rendering via an external render farm.

Fortunately, this appears to not happen with the updated LensDistortion2 node released with Nuke11.

Customer reported version
nuke.10.0v5

Customer reported platform
centos7

Steps to reproduce

1) Create a Checkerboard node

2) Attach a LensDistortion1 node to the Checkerboard node.

3) Edit the 'Radial Distortion' 1 & 2 to any value which is not 0

4) Attach a Write node and set the file directories.

5) Render the scene

6) Once rendered, delete a few rendered frames

7) In your Script Editor, copy and execute the following:

def renderTest():    node = nuke.thisNode()    print os.path.exists(node['file'].evaluate())    if os.path.exists(node['file'].evaluate()):        print "The render exists, cancelling"        nuke.cancel()    else:        print "The render does not exist"nuke.addBeforeFrameRender(renderTest)
8) Try rendering your scene again.

Result: The Render will skip everything once it hits an existing file, then will throw the exception:


Workaround
 
Option 1
 
Instead of using 'nuke.cancel()' to cancel the frame render process, rename the existing frame file knob in the Write node to 'Null'.
 
This can be done by the adding the following to your write node:

# BEFORE RENDEROriginalPath = nuke.thisNode()['file'].value()# BEFORE FRAME RENDERif os.path.exists(nuke.thisNode()['file'].evaluate()):     nuke.thisNode()['file'].setValue("noexport.null")nuke.thisNode()['file'].setValue(OriginalPath)
 
Or copy Pasting the following node into your Node Graph:

set cut_paste_input [stack 0]version 11.1 v2push $cut_paste_inputWrite { file "C:/Users/CS_SYD_PC2/Pictures/Test_Footage/NukeWriteTests _1/Test_Skips.%04d.png" file_type png checkHashOnRead false version 98 beforeRender "OriginalPath = nuke.thisNode()\['file'].value()" beforeFrameRender "if os.path.exists(nuke.thisNode()\['file'].evaluate()): \n    nuke.thisNode()\['file'].setValue(\"noexport.null\")\nnuke.thisNode()\['file'].setValue(OriginalPath)" name Write2 selected true xpos -89 ypos 194}

Option 2

The issue has been resolved with the updated LensDistortion2 node.
 
This node is available in Nuke11 and has replaced the older LensDistortion1 as the default tabbed choice.

Reproduced by support
This bug has been reproduced in:
(Runs through render skipping all frames, exception at end)
Nuke11.1v2 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.1v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.0v3 - Windows 7 - Mac10.12 - CentOS6.9
Nuke11.0v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.5v7 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.5v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke10.0v6 - Windows 7 - Mac10.12 - CentOS6.9

(Exits the render immediately, no progress bar, exception at end)
Nuke10.0v1 - Windows 7 - Mac10.12 - CentOS6.9
Nuke9.0v9 - Windows 7 - Mac10.12 - CentOS6.9

(Renders the frames, but they are all black )
Nuke9.0v1 - Windows 7 - Mac10.12 - CentOS6.9 - Regression
 
Unable to reproduce the bug in:
Nuke8.0v7 - Windows 7 - Mac10.12 - CentOS6.9
Nuke7.0v10 - Windows 7 - Mac10.12 - CentOS6.9

Earliest version tested
Nuke8.0v7  - This issue no longer appears in this version and has regressed

Expected behaviour
Frames that exist in the chosen file directory should be skipped when rendering (as expected by the nuke.cancel() )

Actual behaviour
The render fails when cancelling any frame renders (with the nuke.cancel() call )
 

    We're sorry to hear that

    Please tell us why