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

Increase the maxBuffer to 10MB for the diff process #167

Merged
merged 3 commits into from
Feb 8, 2020

Conversation

Gaelan
Copy link
Contributor

@Gaelan Gaelan commented Jan 19, 2020

By default, Node's spawnSync has a maxBuffer of 1 MB. This bumps it up to 10 MB, which should reduce the chance of diffs on large images failing.

@Gaelan Gaelan requested a review from a team as a code owner January 19, 2020 20:44
@anescobar1991
Copy link
Member

Just out of curiosity how large are the images you are diffing that this is a problem?

Copy link
Member

@anescobar1991 anescobar1991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an integration test to validate this change and make sure we don't regress on it in the future?

@Gaelan
Copy link
Contributor Author

Gaelan commented Jan 23, 2020 via email

@Gaelan
Copy link
Contributor Author

Gaelan commented Jan 23, 2020

Weird… that integration test without the accompanying fix fails on my machine (macOS), but passes on Travis. OS difference maybe? I'll investigate more when I have a bit more time over the weekend.

@Gaelan Gaelan force-pushed the max-buffer branch 2 times, most recently from 3f2564c to 93d6717 Compare January 26, 2020 21:41
@Gaelan
Copy link
Contributor Author

Gaelan commented Jan 26, 2020

Alright, I added a test. Weirdly, the test (without the patch) fails both on my laptop (macOS) and in a Linux docker container, but not on Travis. Any idea why that might be the case?

@anescobar1991
Copy link
Member

Maybe it is a different version of node on the travis build vs locally on your machine?

@Gaelan
Copy link
Contributor Author

Gaelan commented Jan 28, 2020

Yep, that's it. Passes on Node 10, fails on Node 13. Would you be OK with adding Node 13 to the travis config?

@anescobar1991
Copy link
Member

Sure let's do that, so then this bug is not an issue yet right? Only an issue on non LTS node 13?

By default, Node's spawnSync has a maxBuffer of 1 MB. This bumps it up
to 10 MB, which should reduce the chance of diffs on large images
failing.
@Gaelan
Copy link
Contributor Author

Gaelan commented Feb 1, 2020

Now that you guys added node 12 to the travis.yml, it happens as expected: the new test fails until you add the fix, then it passes. (Note that GitHub shows the commits backwards because I rebased them to make the test come before the fix, but the timestamp still shows the test as later.)

@anescobar1991
Copy link
Member

anescobar1991 commented Feb 1, 2020

Thanks @Gaelan I see in the node docs that the default max buffer was 200 X 1024 bytes in node 10 and 1024 X 1024 bytes in node 12 so that is why there was a discrepancy.

https://nodejs.org/docs/latest-v12.x/api/child_process.html#child_process_child_process_spawnsync_command_args_options
https://nodejs.org/docs/latest-v10.x/api/child_process.html#child_process_child_process_spawnsync_command_args_options

@chris-erickson
Copy link

@anescobar1991 anything blocking a merge on this? Appreciate your consideration on this thus far!

@nellyk nellyk self-requested a review February 7, 2020 17:01
@anescobar1991 anescobar1991 merged commit 0927826 into americanexpress:master Feb 8, 2020
oneamexbot added a commit that referenced this pull request Mar 24, 2020
# [3.0.0](v2.12.0...v3.0.0) (2020-03-24)

### Bug Fixes

* **diff:** small default maxBuffer ([df713f6](df713f6))
* **diff-snapshot:** dumpDiffToConsole base64 string output ([#183](#183)) ([f73079f](f73079f))

### chore

* **packages:** updating jest to 25.1 for perf improvements ([#170](#170)) ([eb3dfa6](eb3dfa6))
* **packages:** upgrade from pixelmatch 4.x to 5.x, and pngjs to 3.4 ([#186](#186)) ([1edc9a3](1edc9a3))
* **travis:** remove node 6 from travis config ([ce2b757](ce2b757))

### Features

* **diff:** increase the maxBuffer to 10MB for the diff process ([#167](#167)) ([0927826](0927826))

### BREAKING CHANGES

* **packages:** pixelmatch is being major version bumped and so image diffs may be difference
* **packages:** Node min version is now 8
* **travis:** drop support for node 6
@oneamexbot
Copy link
Contributor

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this pull request Jul 23, 2023
…icanexpress#167)

By default, Node's spawnSync has a maxBuffer of 1 MB. This bumps it up
to 10 MB, which should reduce the chance of diffs on large images
failing.
goverdhan07 pushed a commit to goverdhan07/jest-image-snapshot that referenced this pull request Jul 23, 2023
# [3.0.0](americanexpress/jest-image-snapshot@v2.12.0...v3.0.0) (2020-03-24)

### Bug Fixes

* **diff:** small default maxBuffer ([df713f6](americanexpress@df713f6))
* **diff-snapshot:** dumpDiffToConsole base64 string output ([americanexpress#183](americanexpress#183)) ([f73079f](americanexpress@f73079f))

### chore

* **packages:** updating jest to 25.1 for perf improvements ([americanexpress#170](americanexpress#170)) ([eb3dfa6](americanexpress@eb3dfa6))
* **packages:** upgrade from pixelmatch 4.x to 5.x, and pngjs to 3.4 ([americanexpress#186](americanexpress#186)) ([1edc9a3](americanexpress@1edc9a3))
* **travis:** remove node 6 from travis config ([ce2b757](americanexpress@ce2b757))

### Features

* **diff:** increase the maxBuffer to 10MB for the diff process ([americanexpress#167](americanexpress#167)) ([0927826](americanexpress@0927826))

### BREAKING CHANGES

* **packages:** pixelmatch is being major version bumped and so image diffs may be difference
* **packages:** Node min version is now 8
* **travis:** drop support for node 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants