Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The simplest loader results in an infinite loop of module loading #47655

Closed
giltayar opened this issue Apr 21, 2023 · 2 comments
Closed

The simplest loader results in an infinite loop of module loading #47655

giltayar opened this issue Apr 21, 2023 · 2 comments
Labels
loaders Issues and PRs related to ES module loaders

Comments

@giltayar
Copy link
Contributor

giltayar commented Apr 21, 2023

Version

v20.0.0

Platform

Linux Dell-GilTayar 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

modules

What steps will reproduce the bug?

// loader.mjs
console.log('loader loading...')

export const resolve = (a, b, nextResolve) => nextResolve(a, b)
export const load = (a, b, nextLoad) => nextLoad(a, b)

// index.mjs
setTimeout(() => {}, 1000000)

You can find the above code here: https://github.com/giltayar/global-preload-called-twice

Now run node --no-warnings --loader=./loader.mjs index.mjs

How often does it reproduce? Is there a required condition?

Every time it runs.

What is the expected behavior? Why is that the expected behavior?

See Loader loading... once

What do you see instead?

An infinite loop of loader loading... console lines until the program ends.

Additional information

I found it out while coding quibble (a module mock library) to support off worker threads. A simple loader, while being infinitely loaded, will still work: probably the first module loaded is used, but the module loading will continue while the program is running. quibble failed to work because it uses globalPreload and that was being called again and again and again...

@giltayar
Copy link
Contributor Author

Just saw this: #47566. Probably the same bug.

@aduh95
Copy link
Contributor

aduh95 commented Apr 22, 2023

Closing as duplicate of #47566

@aduh95 aduh95 closed this as completed Apr 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
loaders Issues and PRs related to ES module loaders
Projects
None yet
Development

No branches or pull requests

3 participants