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

v5: Stuck in infinite loop in some cases #2795

Open
4 tasks done
liuxingbaoyu opened this issue Apr 13, 2024 · 2 comments
Open
4 tasks done

v5: Stuck in infinite loop in some cases #2795

liuxingbaoyu opened this issue Apr 13, 2024 · 2 comments

Comments

@liuxingbaoyu
Copy link

Before you open this issue, please complete the following tasks:

  • use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
  • if you are looking for help from the gulp team or community, open a discussion.
  • if you think there is a problem with the plugin you're using, open a discussion.
  • if you think there is a bug in our code, open this issue.

What were you expecting to happen?

Works like v4

What actually happened?

Stuck in an infinite loop until OOM.

Please give us a sample of your gulpfile

I tried to find a minimal reproduction but failed.
So this example needs to be run in the https://github.com/babel/babel repository.

Clone https://github.com/babel/babel and run yarn.
Then replace Gulpfile.mjs with the following code and run yarn gulp to reproduce.

import gulp from "gulp";

const defaultPackagesGlob = "./@(codemods|packages|eslint)/*";

gulp.task("default", function () {
  return gulp
    .src(`${defaultPackagesGlob}/src/**/*.d.ts`)
    .pipe(gulp.dest("./test"));
});

Terminal output / screenshots

$ gulp

<--- Last few GCs --->

[2080:0x5fe0360]  2292081 ms: Scavenge 3997.4 (4127.4) -> 3985.4 (4127.7) MB, 5.89 / 0.00 ms  (average mu = 0.249, current mu = 0.057) task; 
[2080:0x5fe0360]  2292139 ms: Scavenge 3998.0 (4127.9) -> 3986.0 (4128.2) MB, 5.23 / 0.00 ms  (average mu = 0.249, current mu = 0.057) task; 
[2080:0x5fe0360]  2295987 ms: Mark-Compact 3999.0 (4128.7) -> 3979.8 (4129.2) MB, 3794.78 / 0.00 ms  (average mu = 0.263, current mu = 0.274) task; scavenge might not succeed


<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
----- Native stack trace -----

 1: 0xcd8bd6 node::OOMErrorHandler(char const*, v8::OOMDetails const&) [gulp bundle-dts]
 2: 0x10aed20 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [gulp bundle-dts]
 3: 0x10af007 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, v8::OOMDetails const&) [gulp bundle-dts]
 4: 0x12cdfe5  [gulp bundle-dts]
 5: 0x12ce4be  [gulp bundle-dts]
 6: 0x12e36e6 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) [gulp bundle-dts]
 7: 0x12e4209  [gulp bundle-dts]
 8: 0x12e4818  [gulp bundle-dts]
 9: 0x1a[34](https://github.com/babel/babel/actions/runs/8594917993/job/23548824406?pr=16413#step:7:35)081  [gulp bundle-dts]

Please provide the following information:

  • OS & version [e.g. MacOS Catalina 10.15.4]: Windows 11
  • node version (run node -v): v21.7.3
  • npm version (run npm -v): 10.5.0
  • gulp version (run gulp -v): 5.0.0

Additional information

@phated
Copy link
Member

phated commented Apr 14, 2024

Thanks for the report. I made a fix in glob-stream that only traverses the glob parent directory, but you are using a glob in the first segment so it will still traverse the node_modules and other directories.

I'm not sure how to fix this easily in our new glob-stream implement, but I believe a workaround would be to separate the glob parts in parens into 3 separate globs.

@liuxingbaoyu
Copy link
Author

Thank you for your quick reply!
I tried splitting it, unfortunately the issue still exists.🤔

import gulp from "gulp";

const defaultPackagesGlob = function (path) {
  return ["./codemods/*", "./packages/*", "./eslint/*"].map(p => p + path);
};

gulp.task("default", function () {
  return gulp
    .src(defaultPackagesGlob("/src/**/*.d.ts"))
    .pipe(gulp.dest("./test"));
});

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

No branches or pull requests

2 participants