sporadic crashes when js changes jit.gl patch cords from a jit.movie to a jit.gl.videoplane

Ryan Ellis's icon

Crashes with jit.movie, js, jit.gl.videoplane

We've been suffering from sporadic crashes when using js code to remove and create jit.gl.texture patch chords between jit.movie and jit.gl.videoplane objects. The crashes have been mostly between a half hour and several hours of the code running fine, although sometimes they happen almosty instantly.

Max Code

Main Patcher

Depends on the Js code and the two abstractions (below).

Max Patch
Copy patch and select New From Clipboard in Max.

Js Code

layoutSwitcher.js
js

jit.movie abstraction

Max Patch
Copy patch and select New From Clipboard in Max.

jit.gl.videoplane abstraction

Max Patch
Copy patch and select New From Clipboard in Max.

The code involved with these crashes has the goal of dynamically rendering videos from a set of jit.movie objects to a set of jit.gl.videoplane objects.

Each jit.movie object lives inside an abstraction (JM) and loads and plays back a single video file on a loop, outputting a texture to the abstraction's outlet. Each JM object currently in use is attached via a jit.gl-style patch cord to another abstraction containing a jit.gl.videoplane object (VP).

We have some js code which dynamically chooses which connections need to be made from a bank of JMs to a bank of VPs. All of the videoplanes inside the VP abstractions draw to a single jit.world context. VPs which are not in use have their internal videoplanes receive a message (enable 0) when they should stop rendering (in case removing the patch cord is not enough to break the link).

In essence, we're trying to recreate the functionality of the matrix object, with its many inputs and outputs. (Early experimentation with the matrix object lead to some unexpected results and was abandoned.) We have the js code deleting and creating patch cords instead of the matrix object routing inlets to outlets.

I've pared down our code to the essential bits.

Crash Logs, Hardware and Software Versions

I'm not sure if the .ips crash report file can be attached so just in case, I've attached some screenshots.

The screenshots include pictures of the trace from the crashing thread (106) as well as thread 0 (just in case that one happens to be useful).

These crashes consistently refer to com.apple.coremedia.rootQueue or com.apple.coremedia.sharedRootQueue.

These crashes have happened on Mac minis with M2 chips running the Sonoma 14.4 OS.

I believe that they have also occurred on a Mac mini with an Intel chip, however instead of Max crashing like it does here, Max hangs and pinwheels indefinitely.

Max version: 8.6.4

The thread that crashed, com.apple.coremedia.rootQueue
The headers at the top of the crash report
Trace for thread 0 which I've included in case it happens to be useful for someone with more knowledge than me

Rob Ramirez's icon

hi Ryan, I'm happy to take a look. Can you bundle up all these dependencies into a zip and attach here?

Ryan Ellis's icon

Thanks! Sorry for the delay. I originally tried to attach them all as a zip, but when I try, I get a pop-up saying "Editor.uploads.unaccepableFileType". I've tried both in firefox and chrome and I don't think I can attach a .zip.

Ryan Ellis's icon

Frustratingly, I have yet to reproduce this crash with the pared-down code that I included in the post. I'm going to continue some more testing to see if I can reproduce these crashes again. I'm working with an artist who does not wish to share their exact code, so I can't make a public post with the original code, however I might be able to share it privately.

One difference between the original and the code that I posted is that the original displays the content in a jit.world window and this version (which refuses to crash) uses a jit.pwindow. I'm going to do some testing with a jit.world to see if the crashes return.

Ryan Ellis's icon

A developer friend helped me make a .zip available at this url. Clicking on the link there that looks like "videoTiler-20240902T..." should automatically download the .zip.

Ryan Ellis's icon

It seems that the crashing does not occur with the built in C74:/media/jitter videos.

I was able to reproduce a crash by using video files with video format: H.264 and audio format: MPEG-4 AAC, 44100 Hz.

I've noticed by opening the QuickTime player, that the built-ins which have not caused crashes (like bball.mov or chickens.mp4) either have:

  • video: Photo - JPEG and audio: MPEG-4 AAC or

  • video: H.264 with no listed audio format.

I'm wondering if the combination of H.264 with MPEG-4 AAC is involved with what's causing the crashing.

Ryan Ellis's icon

It looks like the hunch was correct that the combination of H.264 with MPEG-4 AAC was causing the issue. After using FFMPEG to remove the audio tracks, the crashes seem to have stopped. Code has now been running for multiple days without any crashes.