Make WordPress Core

Opened 9 months ago

Closed 8 weeks ago

Last modified 6 weeks ago

#63606 closed defect (bug) (fixed)

npm run dev: Warning: Maximum call stack size exceeded

Reported by: sirlouen's profile SirLouen Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 7.0 Priority: normal
Severity: normal Version: 3.7
Component: Build/Test Tools Keywords: has-patch has-test-info needs-testing 2nd-opinion
Focuses: Cc:

Description

When running npm run dev an error appears

Warning: Maximum call stack size exceeded

Before it finally crashes with
FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

Commented on Slack and @desrosj informed that he found this when a large number of plugins were sitting on the plugins directory. Presently I have 54 units (all non-active, but still sitting there)

I tried to remove them all, and it appears that this solves the problem.

This has been sitting here since the inception of the first Gruntfile verison [25001]

Change History (12)

This ticket was mentioned in PR #9030 on WordPress/wordpress-develop by @SirLouen.


9 months ago
#1

  • Keywords has-patch added; needs-patch removed

Testing & Reproduction Instructions

  1. Install a ton of plugins. The thing is that if you install block plugins with a zillion node_modules files it will be easier to reproduce. The more files in the plugins directory, the better to reproduce this
  2. Run npm run dev
  3. Check the logs and see if you can spot the Warning: Maximum call stack size exceeded

With the patch, this should be gone

Trac ticket: https://core.trac.wordpress.org/ticket/63606

#2 @SirLouen
9 months ago

  • Keywords has-test-info needs-testing added

#3 @SirLouen
9 months ago

  • Keywords 2nd-opinion added

More information

I've noted that with woocommerce plugin is possible to reproduce this
Not easy to reproduce though: the more files, the easier.

I think that just excluding plugins in watch is enough.
Maybe just adding akismet, although in watch mode, akismet is totally irrelevant. So probably it can be ignored.

#4 @tusharbharti
8 months ago

Reproduction Report

Description

This report validates whether the issue can be reproduced.

Was able to reproduce this on the default WordPress Core wp-env setup

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.28
  • Server: nginx/1.27.5
  • Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 138.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.2
  • MU Plugins: None activated
  • Plugins:
    • Example Static 0.1.0
    • Test Reports 1.2.0

Actual Results

  1. ✅ Error condition occurs (reproduced).

Additional Notes

this seems to happen with the Running "_watch" tasks

Supplemental Artifacts

https://i.ibb.co/pr5mk92n/Screenshot-2025-06-30-at-10-36-15-PM.png

#5 @ankitkumarshah
8 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/9030

Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.29
  • Server: nginx/1.29.0
  • Database: mysqli (Server: 8.0.43 / Client: mysqlnd 8.2.29)
  • Browser: Chrome 138.0.0.0
  • OS: macOS

Actual Results

  1. ✅ Issue resolved with a patch.

Additional Notes

  • For anyone who wants to install a lot of plugins for the test, here is the command:
    npm run env:cli plugin install woocommerce elementor yoast-seo jetpack gutenberg advanced-custom-fields contact-form-7 wordfence updraftplus wpforms-lite all-in-one-wp-migration mailchimp-for-wp really-simple-ssl duplicate-post wp-super-cache akismet classic-editor
    

Supplemental Artifacts

https://i.postimg.cc/4d5QL5P7/image.png

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


8 months ago

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


7 months ago

#8 @SergeyBiryukov
8 weeks ago

  • Milestone changed from Awaiting Review to 7.0

#9 @SergeyBiryukov
8 weeks ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 61475:

Build/Test Tools: Ignore third-party plugins in grunt watch task.

This aims to avoid a JavaScript heap out of memory fatal error when running npm run dev.

Follow-up to [25001].

Props SirLouen, desrosj, tusharbharti, ankitkumarshah, SergeyBiryukov.
Fixes #63606.

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


6 weeks ago

#11 @westonruter
6 weeks ago

@SergeyBiryukov It seems like [61475] isn't accounting for themes? Shouldn't it exclude all non-twenty* themes as well?

#12 @westonruter
6 weeks ago

In 61545:

Build/Test Tools: Optimize uglify:core and copy:files glob patterns in Grunt tasks.

The uglify:core and copy:files tasks utilized broad negative glob patterns (!**/*.min.js and !**/*.map) to exclude files from processing. The glob expansion scans the entire src/ directory tree, including wp-content. For environments where wp-content contains deep directory structures (such as plugins with node_modules dependencies) this traversal becomes prohibitively slow, causing the build process to hang.

This change scopes the exclusion patterns to specific directories (e.g. wp-admin, wp-includes, default themes, and Akismet), limiting the file scan to relevant core paths and preventing unnecessary recursion into wp-content.

In one dev environment, this reduces npm run build:dev from 43s to 9s, and npm run build from 51s to 13s.

Developed in https://github.com/WordPress/wordpress-develop/pull/10809

Follow up to [61475].

Props westonruter, jonsurrell.
See #63606.
Fixes #64563.

Note: See TracTickets for help on using tickets.