Skip to content

fix: sanitize Linux /tmp asset paths on runtime param updates; rate-limit FileNotFoundError (#916)#918

Open
livepeer-tessa wants to merge 1 commit intomainfrom
fix/ltx2-i2v-linux-path-race
Open

fix: sanitize Linux /tmp asset paths on runtime param updates; rate-limit FileNotFoundError (#916)#918
livepeer-tessa wants to merge 1 commit intomainfrom
fix/ltx2-i2v-linux-path-race

Conversation

@livepeer-tessa
Copy link
Copy Markdown
Contributor

Problem

Issue #916: The ltx2 pipeline was generating ~2500 FileNotFoundError per session when a user sets an i2v_image reference image.

Root Cause (2 parts)

1. Path sanitization only happened at load time, not during runtime updates

_sanitize_initial_params was called in _load_pipeline_implementation but never during WebSocket parameter updates. When the frontend sends i2v_image mid-session (user picks a Reference Image while already streaming), the path — e.g. /tmp/.daydream-scope/assets/foo.png from the client's machine — gets forwarded raw to the fal.ai worker, where that /tmp path doesn't exist.

PR #827 added sanitization for Windows paths (e.g. C:\Users\...) but didn't address:

  • Linux paths from a different machine (this issue)
  • Runtime parameter updates (both issues)

2. FileNotFoundError floods logs on every chunk

Even with the correct path, a race condition between CDN download and the first inference chunk causes FileNotFoundError on every processed frame — easily 2500+ per session in the observed window — flooding Grafana.

Session Timeline (from issue)

20:52:52 - WebSocket connected [99a5095b]
20:53:37 - Pipeline ltx2 loaded successfully
20:53:50 - Initial params received (no i2v_image yet)
~20:54:54 - ERROR flood begins: FileNotFoundError on /tmp path
             Repeats at 10-50ms intervals for entire session

Fix

1. Add _sanitize_asset_path / _sanitize_initial_params to PipelineManager

Same logic as PR #827 (Windows path detection) extended to also rewrite Unix absolute paths that fall outside the worker's configured assets directory — catching the Linux-/tmp-from-different-machine case.

2. Apply sanitization at runtime in FrameProcessor.update_parameters

# Sanitize foreign-OS / stale asset paths before they reach the pipeline.
parameters = PipelineManager._sanitize_initial_params(parameters)

This covers mid-session WebSocket parameter updates (e.g. user picking a Reference Image while already streaming).

3. Apply sanitization at load time in _load_pipeline_implementation

Covers plugin pipelines (like ltx2) at load time.

4. Rate-limit repeated FileNotFoundError in PipelineProcessor

Catch FileNotFoundError separately and suppress repeated log entries for the same missing path, emitting at most 1 error per path per 30 seconds. This prevents log floods for any transient race condition during CDN download.

Tests

9 new tests in TestSanitizeAssetPath:

Related

…FileNotFoundError

Issue #916: ltx2 i2v_image path from client's /tmp crashes every chunk

Root cause (two parts):
1. _sanitize_initial_params was only called at pipeline LOAD time, not
   during runtime parameter updates received over WebSocket. When the
   frontend sends i2v_image mid-session (e.g. user picks a Reference Image
   while already streaming), the path from the client machine
   (/tmp/.daydream-scope/assets/foo.png) is forwarded raw to the fal.ai
   worker where that /tmp path doesn't exist.

2. Even with the right path, a race condition between CDN download and the
   first chunk causes FileNotFoundError on every chunk — 2500+ per session
   in the observed window — flooding Grafana logs.

Fixes:
- Add _sanitize_asset_path and _sanitize_initial_params static methods to
  PipelineManager (mirrors the fix from PR #827 for Windows paths, extended
  to also catch Linux /tmp paths from foreign machines).
- Call _sanitize_initial_params in PipelineManager._load_pipeline_implementation
  for plugin pipelines (load-time fix).
- Call _sanitize_initial_params in FrameProcessor.update_parameters for all
  runtime parameter updates (WebSocket mid-session updates).
- In PipelineProcessor.process_chunk, catch FileNotFoundError separately and
  rate-limit repeated log entries for the same missing path to one per 30s,
  preventing log floods while still making the error visible.

Tests: 9 new tests in TestSanitizeAssetPath covering Windows paths, Linux
/tmp foreign paths, relative paths, None values, and list params.

Signed-off-by: Tessa (livepeer-tessa) <tessa@livepeer.org>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 374ca729-6eb7-4c82-b4d5-68fc407e55bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ltx2-i2v-linux-path-race

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 fal.ai Preview Deployment

App ID daydream/scope-pr-918--preview
WebSocket wss://fal.run/daydream/scope-pr-918--preview/ws
Commit bd9f18a

Livepeer Runner

App ID daydream/scope-livepeer-pr-918--preview
WebSocket wss://fal.run/daydream/scope-livepeer-pr-918--preview/ws
Auth private

Testing Livepeer Mode

SCOPE_CLOUD_MODE=livepeer SCOPE_CLOUD_APP_ID="daydream/scope-livepeer-pr-918--preview/ws" uv run daydream-scope

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[fal.ai] ltx2: i2v_image FileNotFoundError on Linux /tmp path — 2500 chunk errors per session (race condition)

1 participant