• Script Node blocking behaviour isn't documented or as expected

Hi,

The docs don't provide an explanation of how data is shared between the ScriptNode and other nodes and what the synchronisation behaviour is. From the people tracker example i can see that tracklets are retrieved from a dict-like object called node.io and that accessing the tracklets appears to be a blocking call. To experiment further, I inserted a 0.5 second sleep in the python script and I noticed that this slowed down both output queues of the pipeline (i.e. both the video output and script output), but it didn't cause the input video queue to back up/block as expected. The tracklets appeared to back up too, which means that if the script is consistently slower than the input stages of the pipeline, then the device will eventually run out of memory.

Would someone be able to describe what the expected behaviour in the above scenario is?

  • erik replied to this.

    rmaxwell it's the same as device queues. If you call io.node['input'].get(), then it will block until a message is received, and if you call io.node['input'].tryGet() it will either return the message (if present), or return None, without blocking. I hope this helps!

      erik What should happen to the input queue in the above scenario, i.e. If the script node slows down both of the output queues, then should the input queue back up?

        Hi rmaxwell
        I assume you didn't specify the queue size explicitly. This would mean the queue size gets set to 30 (default). Did you give the queue enough time to fill up? The queues should eventually block the pipeline once all of them are saturated if none are set to non-blocking.

        Thanks,
        Jaka

          Hi rmaxwell
          Might be a stupid question, but just to be sure; are you passing the video or are you running the pipeline on camera stream? Also, is this the only thing you have changed? So I can try to replicate.

          Thanks,
          Jaka

            Hi rmaxwell
            The pipeline graph of the example shows the object tracker node limits the frame flow. This means frames get discarded there.

            After setting the objectTracker.inputDetections.setBlocking(True) the pipeline is as follows:

            Now no frame gets discarded and the pipeline runs frame by frame as supplied by the xLInkIn.

            Hope this clears things up.

            Thanks,
            Jaka