Syphon In coming from external Python OpenCV makes TD crash

build 2022.28040 / macOS Monterey 12.6

Hello there, I figured this may not be a TD bug so I’m posting here.

My network is literally just a Syphon In. The syphon server is coming from an external py script that sends an OpenCV image using syphonpy. This code is taken from the examples folder. It works, but after like 1 minute running, TD just freezes. It doesn’t close, it just stops responding. Any ideas?

def draw_and_send(self, frame, alpha=False):
        h, w = frame.shape[:2]
        self.size = (w, h)

        glfw.make_context_current(self.window)
        glBindTexture(GL_TEXTURE_2D, self.TextureID)

        if alpha:
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, self.size[0], self.size[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, frame)
        else:
            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, self.size[0], self.size[1], 0, GL_RGB, GL_UNSIGNED_BYTE, frame)

        self.server.publish_frame_texture(self.TextureID, syphonpy.MakeRect(0, 0, self.size[0], self.size[1]), syphonpy.MakeSize(self.size[0], self.size[1]), True)
        
        # Clear screen
        glClear(GL_COLOR_BUFFER_BIT  | GL_DEPTH_BUFFER_BIT )
        # reset the drawing perspective
        glLoadIdentity()

        # Draw texture to screen
        glBegin(GL_QUADS)
        ##
        glTexCoord(0, 0)        
        glVertex2f(0, 0)
        #
        glTexCoord(1,0)
        glVertex2f(self.size[0], 0)
        #
        glTexCoord(1, 1)
        glVertex2f(self.size[0], self.size[1])
        #
        glTexCoord(0,1)
        glVertex2f(0, self.size[1])
        ##
        glEnd()
        
        glfw.swap_buffers(self.window)
        glfw.poll_events()
        
        # unbind our sender texture
        glBindTexture(GL_TEXTURE_2D, 0)

Thanks for the report - hangs shouldn’t happen, whatever the Syphon server is doing, sorry for that. I can’t immediately recreate it here with a modified syphonpy example but we will try on some other machines.

Thank you, anything else you might want me to do to help debug let me know!

Unfortunately I can’t recreate this here on any hardware.

If you could open the Activity Monitor app, select TouchDesigner in the list, and then View > Run Spindump, then save the resulting file and either attach it here or e-mail it to support@derivative.ca, and mention this forum thread, I can take a more detailed look.

Thanks!