zed-industries/zed · error

Failed to start timer thread

Error message

Failed to start timer thread

What it means

The nested timer_handle.insert_source for each delayed runnable panics on error: calloop could not register the one-shot timer source (typically fd exhaustion or event-loop state issues), so the delayed task would never run and the failure is escalated.

Source

Thrown at crates/gpui_linux/src/linux/dispatcher.rs:84

                            let mut runnable = Some(timer.runnable);
                            timer_handle
                                .insert_source(
                                    calloop::timer::Timer::from_duration(timer.duration),
                                    move |_, _, _| {
                                        if let Some(runnable) = runnable.take() {
                                            let location = runnable.metadata().location;
                                            let spawned = runnable.metadata().spawned;
                                            profiler::update_running_task(spawned, location);
                                            runnable.run();
                                            profiler::save_task_timing();
                                        }
                                        TimeoutAction::Drop
                                    },
                                )
                                .expect("Failed to start timer");
                        }
                    })
                    .expect("Failed to start timer thread");

                event_loop.run(None, &mut (), |_| {}).log_err();
            })
            .unwrap();

        background_threads.push(timer_thread);

        Self {
            main_sender,
            timer_sender,
            background_sender,
            _background_threads: background_threads,
            main_thread_id: thread::current().id(),
        }
    }
}

impl PlatformDispatcher for LinuxDispatcher {

View on GitHub (pinned to f4178619ac)

Solutions

  1. Check ulimit -n for file descriptor exhaustion from many pending timers
  2. Verify the timer event loop handle is alive and dispatching
  3. Batch timers via a single source/heap instead of one source per timer
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at crates/gpui_linux/src/linux/dispatcher.rs:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/a6cb9e1f1e868ea1. Report an issue: GitHub.