Skip to content

raea render of a long 4K composition hangs before its first frame about half the time (main thread waiting in wait_flush), with no output and no exit #158

Open

Description

@Ragulsundaram

What happens

About half the time, raea render of a long 4K composition hangs before its first frame and never finishes: no frames written, no log lines at all, ~0% CPU, until it's killed. Run the same command again and it often renders all frames in ~52 s.

Counts on one composition (2160x3840, 30 fps, 752 frames; --alpha to a folder of PNGs; macOS 26.5, Apple silicon):

version hung (0 frames after 20 s; a good run has ~130 by then)
0.1.2 2 of 6
0.1.3 1 of 4
0.1.4 3 of 6, 5 of 6 in another batch

It happens with or without --alpha, with a cold or warm cache, and with or without RAEA_OFFLINE=1. It's random, not tied to one scene: single frames (--frame 0, --frame 100, 16 tries) never hang, and the same composition cut to 150, 376, 560 or 704 frames hung 0 to 2 times in 5 or 6 tries, so a longer render seems to make it more likely.

Where it's stuck (sample of a hung 0.1.4 process)

The main thread waits for a React flush during the frame planning, and doesn't come back:

raea_cli::cli::cli
raea_runtime_export::render::render
raea_runtime_export::render::render_bundle
raea_runtime_export::fed::scene_frames
raea_runtime_react::scene::settle::settle_with
raea_runtime_react::wait_flush
std::sys::sync::condvar::pthread::Condvar::wait_timeout
_pthread_cond_wait / __psynch_cvwait

The raea-runtime-react js thread is parked too, in semaphore_timedwait (4097 of 4101 samples), and the async-io thread is waiting on a mutex. So it looks like the flush that wait_flush waits for never comes, or is signalled before the wait starts. The three threads from the sample are below.

Expected

The render either finishes or, if a flush really never comes, fails after a timeout with an error naming the frame, rather than waiting forever with no output.

Why it matters

We render our videos in an unattended script. A hang with no output and no exit stalls the whole run, and the only fix is a watchdog that kills and restarts it.

Repro

I couldn't cut it down to a small file: it's random, and small compositions (a few 3D and 2D ones, 120 frames) didn't hang in 6 to 10 tries each. The composition that hangs is our 25 s portrait video's graphics layer: many components under <Sequence>s, web fonts by @font-face, <Img>s, and the 6-layer <Freeze> motion blur from #96. I can share the project privately, or run a debug build or a trace env var if that helps.

sample of a hung process (raea 0.1.4)
    4101 Thread_1206661   DispatchQueue_1: com.apple.main-thread  (serial)
    + 4101 start  (in dyld) + 6652
    +   4101 main  (in raea) + 52
    +     4101 _RNvNtCsdnanKjkF2cC_3std2rt19lang_start_internal  (in raea) + 936
    +       4101 ???  (in raea)  load address 0x1044b8000 + 0x9587608
    +         4101 ???  (in raea)  load address 0x1044b8000 + 0x958763c
    +           4101 ???  (in raea)  load address 0x1044b8000 + 0x958743c
    +             4101 _RNvCs8vn7rXXCnHr_8raea_cli4main  (in raea) + 304
    +               4101 _RNvNtCs8vn7rXXCnHr_8raea_cli3cli3cli  (in raea) + 588
    +                 4101 ???  (in raea)  load address 0x1044b8000 + 0xa611b7c
    +                   4101 _RNvNtCsfFjt16PZL7Q_19raea_runtime_export6render6render  (in raea) + 6576
    +                     4101 _RNvNtCsfFjt16PZL7Q_19raea_runtime_export6render13render_bundle  (in raea) + 920
    +                       4101 ???  (in raea)  load address 0x1044b8000 + 0xb448ccc
    +                         4101 _RNvNtCsfFjt16PZL7Q_19raea_runtime_export3fed12scene_frames  (in raea) + 2624
    +                           4101 ???  (in raea)  load address 0x1044b8000 + 0xb472584
    +                             4101 ???  (in raea)  load address 0x1044b8000 + 0xb3f4ba8
    +                               4101 _RNvNtNtCsh7nUNHSbqk6_18raea_runtime_react5scene6settle11settle_with  (in raea) + 5468
    +                                 4101 _RNvCsh7nUNHSbqk6_18raea_runtime_react10wait_flush  (in raea) + 144
    +                                   4101 ???  (in raea)  load address 0x1044b8000 + 0xb76fa9c
    +                                     4101 _RNvMNtNtNtNtCsdnanKjkF2cC_3std3sys4sync7condvar7pthreadNtB2_7Condvar12wait_timeout  (in raea) + 172
    +                                       4101 _pthread_cond_wait  (in libsystem_pthread.dylib) + 1024
    +                                         4101 __psynch_cvwait  (in libsystem_kernel.dylib) + 8
    4101 Thread_1206682: async-io
    + 4101 thread_start  (in libsystem_pthread.dylib) + 8
    +   4101 _pthread_start  (in libsystem_pthread.dylib) + 136
    +     4101 ???  (in raea)  load address 0x1044b8000 + 0xdb07f3c
    +       4101 ???  (in raea)  load address 0x1044b8000 + 0x13b97c
    +         4101 _RINvNtNtCsdnanKjkF2cC_3std3sys9backtrace28___rust_begin_short_backtraceNCNCNvNtCsiORDUAae90b_8async_io6driver8unparker00uEB1f_  (in raea) + 12
    +           4101 ???  (in raea)  load address 0x1044b8000 + 0x13c014
    +             4101 _pthread_mutex_firstfit_lock_slow  (in libsystem_pthread.dylib) + 216
    +               4101 _pthread_mutex_firstfit_lock_wait  (in libsystem_pthread.dylib) + 84
    +                 4101 __psynch_mutexwait  (in libsystem_kernel.dylib) + 8
    4101 Thread_1206693: raea-runtime-react js
    + 4101 thread_start  (in libsystem_pthread.dylib) + 8
    +   4101 _pthread_start  (in libsystem_pthread.dylib) + 136
    +     4101 ???  (in raea)  load address 0x1044b8000 + 0xdb07f3c
    +       4101 ???  (in raea)  load address 0x1044b8000 + 0xb7935fc
    +         4099 _RINvNtNtCsdnanKjkF2cC_3std3sys9backtrace28___rust_begin_short_backtraceNCNvXs1_Csh7nUNHSbqk6_18raea_runtime_reactNtB1f_11ReactPluginNtNtCsandNWqoKTtb_8bevy_app6plugin6Plugin5build0
    +         ! 4099 ???  (in raea)  load address 0x1044b8000 + 0xb772cb0
    +         !   4097 ???  (in raea)  load address 0x1044b8000 + 0xb770c94
    +         !   : 4097 _dispatch_semaphore_wait_slow  (in libdispatch.dylib) + 76
    +         !   :   4097 _dispatch_sema4_timedwait  (in libdispatch.dylib) + 64
    +         !   :     4097 semaphore_timedwait_trap  (in libsystem_kernel.dylib) + 8
    +         !   1 ???  (in raea)  load address 0x1044b8000 + 0xb770c04
    +         !   : 1 ???  (in raea)  load address 0x1044b8000 + 0xdae9268
    +         !   1 ???  (in raea)  load address 0x1044b8000 + 0xb770d7c
    +         2 _RINvNtNtCsdnanKjkF2cC_3std3sys9backtrace28___rust_begin_short_backtraceNCNvXs1_Csh7nUNHSbqk6_18raea_runtime_reactNtB1f_11ReactPluginNtNtCsandNWqoKTtb_8bevy_app6plugin6Plugin5build0uEB
    +           1 _RNvXs0_NtNtCsi0uoaqzLwDq_21raea_runtime_jsengine3jsc4hostNtB5_3JscNtB9_8JsEngine4call  (in raea) + 60
    +           : 1 ???  (in raea)  load address 0x1044b8000 + 0xb4e1bec
    +           :   1 malloc  (in libsystem_malloc.dylib) + 0
    +           1 _RNvXs0_NtNtCsi0uoaqzLwDq_21raea_runtime_jsengine3jsc4hostNtB5_3JscNtB9_8JsEngine4call  (in raea) + 88
    +             1 _RNvMs_NtCsi0uoaqzLwDq_21raea_runtime_jsengine3jscNtB4_7Context8call_num  (in raea) + 92
    +               1 JSObjectGetProperty  (in JavaScriptCore) + 88
    +                 1 OpaqueJSString::identifier(JSC::VM*) const  (in JavaScriptCore) + 72
    +                   1 WTF::AtomStringImpl::add(std::span<unsigned char const, 18446744073709551615ul>)  (in JavaScriptCore) + 324

Activity

  1. added a commit that references this issue on Nov 15, 2026
  2. Ragulsundaram commented on Nov 16, 2026

    @Ragulsundaram
    ContributorAuthor

    Still happens on 0.1.5: 1 of 6 runs of the same composition hung before its first frame (0 frames after 20 s, ~0% CPU, no output), the other 5 rendered all 753 frames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions