-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Upgrade terser-webpack-plugin to 2.3.5 #39535
Conversation
Test live: https://calypso.live/?branch=upgrade/terser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Looks good, thanks! Let's wait for e2e then 🚢
The |
Rerunning the job. It seems to fail intermittently 😕 Failed job: https://circleci.com/gh/Automattic/wp-calypso/604876 |
The second run failed, too. The same way. I like permanent failures, they are easier to debug than the intermittent ones 😉 |
9189d9f
to
be1733a
Compare
For the record, there are three kinds of When a worker process fails, the pool tries to restart it several times (default is 3). Two of the three errors I've seen happen when the worker process fails (in the
The common theme is that the worker processes are unexpectedly crashing. I suspect it's because the CircleCI box is running out of memory. Not the Node.js process and its heap, but the virtual machine and it's OS itself. Our CircleCI boxes are just 2CPU/4096MB, which is not much. |
85e82ea
to
c40f26c
Compare
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~35777 bytes removed 📉 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~560534 bytes removed 📉 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~448697 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Moment.js Locales (~3979 bytes removed 📉 [gzipped])
Locale data for moment.js. Unless you are upgrading the moment.js library, changes in these chunks are suspicious. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
It passed! |
I reached a conclusion about why Terser is misbehaving during the icfy-analyze job: the CircleCI box it runs in is running out of memory, and the Terser worker processes get a SIGKILL signal from the kernel. The The root cause for us is that the CircleCI boxes are only 2CPU/4096MB. The The |
c40f26c
to
d3b9bbb
Compare
…rcle CI Running the minifier in the main process and only in one thread should consume less memory overall than spawning a separate worker process.
d3b9bbb
to
29f8c09
Compare
@sirreal I think it's random -- sometimes is fails, sometimes it succeeds, depending on whether the particular job happens to run out of memory or not. |
Thank you for looking into this so extensively, @jsnajdr! In order to definitively solve the issue, I take it we'd need to either increase the amount of memory in our CircleCI instances, or reduce Terser memory usage somehow? |
I believe if we migrate to GitHub actions, which I'd expect to be fairly straightforward for this, we'd we’d get 7GB:
https://docs.microsoft.com/en-us/azure/virtual-machines/dv2-dsv2-series I think that's the most interesting avenue to explore. |
@sgomes I tried something in 29f8c09 -- disable the But it didn't work: the main Node.js process was killed by the I don't have any other ideas. @sirreal suggestion to use Github Actions seems like the best one. Or we can increase memory for the CircleCI container -- how does one do that? I don't know. |
Outdated, we are in |
Upgrades
terser-webpack-plugin
to the latest version. I was careful to ensure that the lockfile diff indeed updates only this package and its dependencies, and doesn't include unrelated updates to packages likebabel-*
.The new
terser-webpack-plugin
version has better error reporting. Ouricfy-stats
job in CircleCI often fails with errors from webpack like this one:The "Call retries were exceeded" error comes from
jest-worker
, which runs a pool of parallel child processes withterser
that consume a queue of files to minify. If the child process exits with non-zero exit code,jest-worker
tries to run it again one or more times.But in the error message above, we don't see why
terser
failed at all! That's what the newterser-webpack-plugin
attempts to fix, looking at the worker process stdout and stderr and reporting it.Previous attempt at the upgrade had to be reverted by @blowery in #39400. Because there were errors on Edge, due to incorrect transpilation of object spread syntax? I believe this is not related to
terser-webpack-plugin
at all. The unwanted lockfile updates ofbabel-*
package likely caused that.See also: #39502 where the
icfy-stats
was made to fail when errors like this happen.