ID 504003 - Using Python logging in Nuke can cause it to hang/freeze if lots of logs are output to the terminal/Script Editor

Follow

Problem summary
Using Python logging in Nuke can cause it to hang/freeze if lots of logs are output to the terminal/Script Editor
 
Customer reported version
nuke.12.0v8
 
Customer reported platform
Windows and Linux
 
Steps to reproduce
 
1) Open Nuke

2) Open the Script Editor and run the following code:
 

import logginglogger = logging.getLogger(__name__)logger.setLevel(logging.DEBUG)formatter = logging.Formatter("||%(name)s | %(levelname)s || %(message)s")log_handler = logging.StreamHandler()log_handler.setLevel(logging.DEBUG)log_handler.setFormatter(formatter)logger.addHandler(log_handler)def knobChangedTest():    logger.info(nuke.thisNode().name())    logger.info(nuke.thisKnob().name())    logger.info(nuke.thisNode().name())    logger.info(nuke.thisKnob().name())    logger.info(nuke.thisNode().name())    logger.info(nuke.thisKnob().name())    nuke.addKnobChanged(knobChangedTest)
 
3) Create a Grade node, and drag it around the node graph, the UI will react slowly/lag.
 
If you run similar code using print() or nuke.tprint(), then the same slowdown does not occur.
 
Expected behaviour
For Nuke's interactive behaviour to remind smooth and snappy
 
Actual behaviour
Nuke starts to lag when outputting Python logger logs to the terminal.
 
Workaround
If you log directly to a file, then the issue appears to be reduced.
 
Reproduced by support
This bug has been reproduced in:
Nuke 13.1v3 - Windows 10, macOS 10.15, CentOS 7 *
Nuke 12.0v1 - Windows 10
Nuke 9.0v1 - Windows 10, macOS 10.15
 
*  On CentOS 7, you have to run the code 5-10 times before you start to see the slowdown.
 
Earliest version tested
Nuke 9.0v1 - This issue appears to be in all versions of the product
 

    We're sorry to hear that

    Please tell us why