gulpjs / gulpjs/gulp

v5: Stuck in infinite loop in some cases

Open
#2,795 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
32.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

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

* [x] use the search bar at the top of the page to search this repository for similar issues or discussions that have already been opened.
* [x] if you are looking for help from the gulp team or community, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [x] if you think there is a problem with the plugin you're using, open a [discussion](https://github.com/gulpjs/gulp/discussions).
* [x] 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.
```js
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

```sh
$ 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.