Content-Length: 403784 | pFad | https://redirect.github.com/babel/babel/pull/17915

51 Fix thread synchronization issues in `@babel/register` by liuxingbaoyu · Pull Request #17915 · babel/babel · GitHub
Skip to content

Fix thread synchronization issues in @babel/register#17915

Merged
JLHwung merged 1 commit into
babel:mainfrom
liuxingbaoyu:fix-atomic
Apr 6, 2026
Merged

Fix thread synchronization issues in @babel/register#17915
JLHwung merged 1 commit into
babel:mainfrom
liuxingbaoyu:fix-atomic

Conversation

@liuxingbaoyu
Copy link
Copy Markdown
Member

Q                       A
Fixed Issues? Fixes #1, Fixes #2
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

We have already applied the fix to @babel/eslint-parser.
Ref: #14541

https://github.com/babel/babel/actions/runs/23682460647/job/68996658460

FAIL packages/babel-node/test/batch-test-runner/3.js
babel-node [3/8] > cli arguments-categories
    Error: "/home/runner/work/babel/babel/packages/babel-node/lib/babel-node" "--expose_gc" "-w" "./plugin-binary.js" "./foo.js" "--expose-gc-as=gc2" "--config-file" "./config.json" "--extensions=.js,.ts" "bar": expect(received).toBe(expected) // Object.is equality
    
    - Expected
    + Received
    
      Warning: --expose-gc-as, --config-file, --extensions are a valid option for Babel or Node.js, but they are defined after the script name. Up to Babel 7 they would have been passed to Babel, while now they are passed to the script itself.
        If the intention is to pass them to Babel, move them before the filename:
          babel-node --expose_gc -w ./plugin-binary.js --expose-gc-as=gc2 --config-file ./config.json --extensions=.js,.ts ./foo.js bar
        If passing them to the script is intended, you can silence this warning by explicitly using the -- separator before the script name:
          babel-node --expose_gc -w ./plugin-binary.js -- ./foo.js --expose-gc-as=gc2 --config-file ./config.json --extensions=.js,.ts bar
    + /home/runner/work/babel/babel/packages/babel-register/lib/worker-client.cjs:49
    +         message
    +         ^
    +
    + TypeError: Cannot destructure property 'message' of 'worker_threads.receiveMessageOnPort(...)' as it is undefined.
    +     at WorkerClient.<anonymous> (/home/runner/work/babel/babel/packages/babel-register/lib/worker-client.cjs:49:9)
    +     at WorkerClient.transform (/home/runner/work/babel/babel/packages/babel-register/lib/worker-client.cjs:23:22)
    +     at compile (/home/runner/work/babel/babel/packages/babel-register/lib/hook.cjs:26:25)
    +     at Module._compile (/home/runner/work/babel/babel/node_modules/pirates/lib/index.js:124:29)
    +     at node:internal/modules/cjs/loader:1943:10
    +     at Object.newLoader [as .js] (/home/runner/work/babel/babel/node_modules/pirates/lib/index.js:134:7)
    +     at Module.load (node:internal/modules/cjs/loader:1533:32)
    +     at Module._load (node:internal/modules/cjs/loader:1335:12)
    +     at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    +     at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    +
    + Node.js v24.14.0
        at assertTest (file://redirect.github.com/home/runner/work/babel/babel/packages/babel-helper-transform-fixture-test-runner/src/process.ts:105:24)
        at ChildProcess.<anonymous> (file://redirect.github.com/home/runner/work/babel/babel/packages/babel-helper-transform-fixture-test-runner/src/process.ts:349:17)
        at ChildProcess.emit (node:events:508:28)
        at maybeClose (node:internal/child_process:1100:16)
        at Socket.<anonymous> (node:internal/child_process:457:11)
        at Socket.emit (node:events:508:28)
        at Pipe.<anonymous> (node:net:346:12)

@babel-bot
Copy link
Copy Markdown
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/61275

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 29, 2026

Open in StackBlitz

commit: 97e99d7


constructor() {
super((action, payload) => {
this.#signal[0] = 0;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I still don't know why reusing SharedArrayBuffer is causing the problem. Would using Atomics.store help here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe, as Atomics.store has some ordering gurantees about how write operations happen. Not sure though.

@JLHwung JLHwung added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label Apr 6, 2026
@JLHwung JLHwung merged commit 91b4ce3 into babel:main Apr 6, 2026
56 checks passed
nicolo-ribaudo pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 24, 2026
nicolo-ribaudo pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 24, 2026
nicolo-ribaudo pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 24, 2026
JLHwung pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 29, 2026
JLHwung pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 30, 2026
JLHwung pushed a commit to nicolo-ribaudo/babel that referenced this pull request Apr 30, 2026
nicolo-ribaudo pushed a commit that referenced this pull request Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Bug Fix 🐛 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://redirect.github.com/babel/babel/pull/17915

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy