Skip to content

fix(core): stop the bind setTimeout from shadowing the global one - #82

Merged
Project516 merged 1 commit into
masterfrom
fix/bind-settimeout-shadow
Oct 6, 2026
Merged

Project516 merged 1 commit into
masterfrom
fix/bind-settimeout-shadow

Conversation

@Project516

Copy link
Copy Markdown
Owner

What

Renames the core glue's function setTimeout(timeout) in src/bind/ffmpeg/bind.js to setExecTimeout. Module.setTimeout keeps its name, so the API does not change. A Node test checks that no top-level function in bind.js is named like a global.

Why

bind.js is linked as pre-js, so it shares a scope with Emscripten's glue. The built core shows that safeSetTimeout (async callbacks) and ___syscall_poll call setTimeout(...), and they got ours. Ours stores its first argument in Module.timeout and schedules nothing. A timer the glue sets never fires, and the next exec() can pick up a function as its timeout. This is upstream ffmpegwasm#611, found while porting upstream's regression tests in #81.

Testing

I ran the new check by hand against master's bind.js, where it reports setTimeout, and against this branch, where it reports nothing. Not run locally: the core build and the rest of the tests, which only run in CI.

Noticed, not fixed

  • bind.js and tests/ffmpeg-node.test.mjs already fail prettier --check on master.

@coderabbitai

coderabbitai Bot commented Oct 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ebbb8bd8-c9ec-4cec-8605-0e2d3f3c0ca0
📥 Commits

Reviewing files that changed from the base of the PR and between 415f0bd and 0df92ca.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/bind/ffmpeg/bind.js
  • tests/ffmpeg-node.test.mjs
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@project516-review-bot project516-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR renames the core's setTimeout function to setExecTimeout to prevent shadowing the global setTimeout in the Emscripten glue scope, updates Module.setTimeout to maintain the API, and adds a test to ensure no top-level function in bind.js shadows a global. This fixes the issue where Emscripten's timers (like poll and async callbacks) would call the core's ineffective setTimeout instead of the global one, causing timers to not fire.


review-bot, model nvidia/nemotron-3-super-120b-a12b:free, verdict approve

@Project516
Project516 merged commit 2f4d7de into master Oct 6, 2026
19 checks passed
@Project516
Project516 deleted the fix/bind-settimeout-shadow branch October 6, 2026 01:07
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.

1 participant