addyosmani / addyosmani/critical

Calling `critical.generate` lots of times in parallel seems to cause MaxListenersExceededWarning

Đang mở
#528 6 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
10.3k
Fork
390
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

I am the author of the [eleventy-critical-css](https://github.com/gregives/eleventy-critical-css) Eleventy plugin which calls `critical.generate` for every HTML file outputted by Eleventy. [An issue](https://github.com/gregives/eleventy-critical-css/issues/7) was filed on eleventy-critical-css saying that the plugin was causing a MaxListenersExceededWarning.

When the plugin is used with larger Eleventy sites, `critical.generate` is called lots of times in parallel and it causes a MaxListenersExceededWarning. Here is the stack trace:

```
(node:12968) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added to [process]. Use emitter.setMaxListeners() to increase limit
at _addListener (events.js:475:17)
at process.addListener (events.js:497:10)
at module.exports (D:\Projects\critical-issue-528-reproduction\node_modules\penthouse\lib\index.js:160:11)
at D:\Projects\critical-issue-528-reproduction\node_modules\critical\src\core.js:75:20
at D:\Projects\critical-issue-528-reproduction\node_modules\p-all\index.js:4:67
at D:\Projects\critical-issue-528-reproduction\node_modules\p-map\index.js:57:28
```

[This repository](https://github.com/atlas-bi/website) was added to the issue on eleventy-critical-css which successfully reproduces the problem. ~~If I have time, I will create a simpler reproduction, probably just by calling `critical.generate` lots of times in parallel.~~ **See new simpler repository below.**

I am unsure if this is a problem with Critical or with Penthouse, let me know if you want me to raise an issue in the Penthouse repository instead. Thanks for your help!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.