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

libuv update in 18.18.0 breaks webpack's thread-loader #49911

Closed
anomiex opened this issue Sep 27, 2023 · 15 comments
Closed

libuv update in 18.18.0 breaks webpack's thread-loader #49911

anomiex opened this issue Sep 27, 2023 · 15 comments
Labels
fs Issues and PRs related to the fs subsystem / file system. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. v20.x v20.x Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.

Comments

@anomiex
Copy link

anomiex commented Sep 27, 2023

Version

v18.18.0

Platform

Linux abulia 6.5.0-1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.5.3-1 (2023-09-13) x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Starting in an empty directory,

  1. Create the following files:
    • package.json:
      {
      	"dependencies": {
      		"thread-loader": "^4.0.2",
      		"webpack": "^5.88.2",
      		"webpack-cli": "^4.10.0"
      	}
      }
    • webpack.config.js:
      const path = require( 'path' );
      
      module.exports = {
          mode: 'production',
          entry: './index.js',
          output: {
              path: path.resolve( __dirname, 'dist' ),
              filename: 'foo.bundle.js',
          },
          module: {
              rules: [
                  {
                      test: /\.(js)$/,
                      exclude: /node_modules/,
                      use: [
                          {
                              loader: require.resolve( 'thread-loader' ),
                          },
                      ],
                  }
              ]
          },
      };
      
  2. Run node -e 'console.log( "console.log( typeof {} );" ); for(let i=0; i<5000; i++){ console.log( "// we need a large file in order to trigger the bug" ); }' > index.js. Increase the "5000" if necessary, I don't know whether it depends on the system in some manner.
  3. npm install
  4. npm exec webpack

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

Always. No requirements I know of beyond what's described above and being on Linux.

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

asset foo.bundle.js 22 bytes [emitted] [minimized] (name: main)
./index.js 254 KiB [built] [code generated]
webpack 5.88.2 compiled successfully in 376 ms

Because that's what happens when webpack runs successfully.

What do you see instead?

Process hangs before producing any output. CPU is not being used, processes seem to be waiting in epoll_pwait.

Additional information

It worked in 18.17.1. fb2b80f appears to be the first failing commit.

Setting UV_USE_IO_URING=0 works around the problem. Of course, that's undocumented and temporary so a real fix would be good.

I found this problem exists in 20.3.0 through 20.6.1 as well, but is not present in 20.7.0. A git bisect turned up 88ba79b as the commit that fixed it. Cherry-picking that commit onto 18.18.0 fixes it for me there too.

So my guess is that the new io_uring stuff started returning short writes when passed a lot of data, which WriteStream didn't handle correctly until 88ba79b fixed it.

See also webpack-contrib/thread-loader#191

@bnoordhuis bnoordhuis added fs Issues and PRs related to the fs subsystem / file system. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. labels Sep 28, 2023
@bnoordhuis
Copy link
Member

The bug fix will be backported to v18.x automatically, it's just a matter of waiting until it shows up in a release.

@matthewp
Copy link

In Astro we had to pin to 18.17.1 after GitHub upgraded its CI to use 18.18. Not getting good stacktraces or failures, just seems to hang. Sounds similar to this issue.

@richardlau
Copy link
Member

I found this problem exists in 20.3.0 through 20.6.1 as well, but is not present in 20.7.0. A git bisect turned up 88ba79b as the commit that fixed it. Cherry-picking that commit onto 18.18.0 fixes it for me there too.

I've cherry-picked 88ba79b (and a4928b0 which it depends on to land cleanly) onto v18.x-staging so it's ready for the next non-security Node.js 18 release. Tentatively we have a release planned for October, see nodejs/Release#737 for the plan, but bear in mind the plan is subject to change based on releaser availability.

FYI @nodejs/lts @nodejs/releasers

@dnalborczyk
Copy link
Contributor

dnalborczyk commented Sep 28, 2023

I'm wondering, since this appears to be a known bug (for a while?) in 20.x, and v18 is currently the only LTS line, shouldn't have the offending commit be either omitted from the v18.18.0 release, or the v18.18.0 release be post-poned while waiting for the fix, or a bugfix release being made now with v18.18.1, as opposed to be waiting for a 18.19.0 release sometime in October?

It's just a bit surprising, but I also don't have the entire context.

NullVoxPopuli added a commit to soxhub/ember-scoped-css that referenced this issue Oct 4, 2023
NullVoxPopuli added a commit to soxhub/ember-scoped-css that referenced this issue Oct 4, 2023
richardlau added a commit that referenced this issue Oct 6, 2023
Notable changes:

This release addresses some regressions that appeared in Node.js 18.18.0:

- (Windows) FS can not handle certain characters in file name
  #48673
- 18 and 20 node images give error - Text file busy (after re-build images)
  nodejs/docker-node#1968
- libuv update in 18.18.0 breaks webpack's thread-loader
  #49911

The libuv 1.45.0 and 1.46.0 updates that were released in Node.js 18.18.0
have been temporarily reverted.

PR-URL: #50065
richardlau added a commit that referenced this issue Oct 6, 2023
Notable changes:

This release addresses some regressions that appeared in Node.js 18.18.0:

- (Windows) FS can not handle certain characters in file name
  #48673
- 18 and 20 node images give error - Text file busy (after re-build images)
  nodejs/docker-node#1968
- libuv update in 18.18.0 breaks webpack's thread-loader
  #49911

The libuv 1.45.0 and 1.46.0 updates that were released in Node.js 18.18.0
have been temporarily reverted.

PR-URL: #50066
@simatec
Copy link

simatec commented Oct 9, 2023

I think here the label would also have to be supplemented with Node20.
Node > 20.2.0 also has the bug

@richardlau richardlau added the v20.x v20.x Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch. label Oct 9, 2023
richardlau added a commit that referenced this issue Oct 10, 2023
Notable changes:

This release addresses some regressions that appeared in Node.js 18.18.0:

- (Windows) FS can not handle certain characters in file name
  #48673
- 18 and 20 node images give error - Text file busy (after re-build images)
  nodejs/docker-node#1968
- libuv update in 18.18.0 breaks webpack's thread-loader
  #49911

The libuv 1.45.0 and 1.46.0 updates that were released in Node.js 18.18.0
have been temporarily reverted.

PR-URL: #50066
@simatec
Copy link

simatec commented Oct 10, 2023

v18.18.1 fix the Problem...
In Node 20 the problem is still present

@anomiex
Copy link
Author

anomiex commented Oct 11, 2023

I think here the label would also have to be supplemented with Node20. Node > 20.2.0 also has the bug

It was fixed in 20.7.0 in my testing.

@simatec
Copy link

simatec commented Oct 11, 2023

In my testing is the same Bug in 20.7.0 and 20.8.0

@anomiex
Copy link
Author

anomiex commented Oct 11, 2023

I just it tested again, 20.6.1 reproduce following the instructions here while 20.7.0 and 20.8.0 do not. Are you following the instructions on this bug, or are you doing something different?

@simatec
Copy link

simatec commented Oct 11, 2023

For us, the error occurs in connection with writestream and CIFS mount

#50061

@bnoordhuis
Copy link
Member

The fix for the issue reported by OP was released in v18.18.1 and v20.7.0. I think some of you may be talking about different-but-similar-looking bugs that are tracked elsewhere so I'll go ahead and close this report.

@bnoordhuis
Copy link
Member

Oh, and @simatec, if you or anyone still experiences issues, then please open (or reopen) an issue but - and this is critical - include full steps to reproduce, without third-party code. That means no npm modules.

@simatec
Copy link

simatec commented Oct 11, 2023

I think the problem still exists in Node 20.8.0. It has only been fixed in 18.18.1 so far. The last working version of Node 20 was 20.2.0

@simatec
Copy link

simatec commented Oct 11, 2023

Oh, and @simatec, if you or anyone still experiences issues, then please open (or reopen) an issue but - and this is critical - include full steps to reproduce, without third-party code.

I had already done that, see issue in the link

#50061

@bnoordhuis
Copy link
Member

Missing the critical bit though: steps to reproduce, see #50061 (comment).

anantakrishna added a commit to PureBhaktiArchive/audioseva that referenced this issue Oct 12, 2023
Using v18.18.1 because GitHub Actions uses v18.18.0 at the moment, and it is prone to a bug in webpack: nodejs/node#49911 (comment)
alexfernandez pushed a commit to alexfernandez/node that referenced this issue Nov 1, 2023
Notable changes:

This release addresses some regressions that appeared in Node.js 18.18.0:

- (Windows) FS can not handle certain characters in file name
  nodejs#48673
- 18 and 20 node images give error - Text file busy (after re-build images)
  nodejs/docker-node#1968
- libuv update in 18.18.0 breaks webpack's thread-loader
  nodejs#49911

The libuv 1.45.0 and 1.46.0 updates that were released in Node.js 18.18.0
have been temporarily reverted.

PR-URL: nodejs#50066
debadree25 pushed a commit to debadree25/node that referenced this issue Apr 15, 2024
Notable changes:

This release addresses some regressions that appeared in Node.js 18.18.0:

- (Windows) FS can not handle certain characters in file name
  nodejs#48673
- 18 and 20 node images give error - Text file busy (after re-build images)
  nodejs/docker-node#1968
- libuv update in 18.18.0 breaks webpack's thread-loader
  nodejs#49911

The libuv 1.45.0 and 1.46.0 updates that were released in Node.js 18.18.0
have been temporarily reverted.

PR-URL: nodejs#50066
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. v18.x Issues that can be reproduced on v18.x or PRs targeting the v18.x-staging branch. v20.x v20.x Issues that can be reproduced on v20.x or PRs targeting the v20.x-staging branch.
Projects
None yet
Development

No branches or pull requests

6 participants