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

ENOBUFS error when comparing large commits #113

Closed
darrenchang opened this issue Jan 11, 2021 · 3 comments
Closed

ENOBUFS error when comparing large commits #113

darrenchang opened this issue Jan 11, 2021 · 3 comments

Comments

@darrenchang
Copy link

I have a really large commit on my private repository. It contains a new json file that has over 40000 lines.
When I try to compare the commit, it shows the following error.

# diff2html v1.1.5 v1.2.7

<ref *1> Error: spawnSync /bin/sh ENOBUFS
    at Object.spawnSync (internal/child_process.js:1067:20)
    at spawnSync (child_process.js:602:24)
    at Object.execSync (child_process.js:647:15)
    at Object.execute (/usr/local/lib/node_modules/diff2html-cli/lib/utils.js:38:36)
    at runGitDiff (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:87:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:125:32)
    at step (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:63:23)
    at Object.next (/usr/local/lib/node_modules/diff2html-cli/lib/cli.js:44:53)
    at /usr/local/lib/node_modules/diff2html-cli/lib/cli.js:38:71
    at new Promise (<anonymous>) {
  errno: -105,
  code: 'ENOBUFS',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'git diff "v1.1.5" "v1.2.7" --no-color ' ],
  error: [Circular *1],
  status: null,
  signal: 'SIGTERM',
  output: [
    null,
    <Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 2e 67 69 74 69 67 6e 6f 72 65 20 62 2f 2e 67 69 74 69 67 6e 6f 72 65 0a 69 6e 64 65 78 20 66 35 35 32 37 34 63 ... 1056718 more bytes>,
    <Buffer >
  ],
  pid: 12472,
  stdout: <Buffer 64 69 66 66 20 2d 2d 67 69 74 20 61 2f 2e 67 69 74 69 67 6e 6f 72 65 20 62 2f 2e 67 69 74 69 67 6e 6f 72 65 0a 69 6e 64 65 78 20 66 35 35 32 37 34 63 ... 1056718 more bytes>,
  stderr: <Buffer >
} []

How can I increase the buffer size to complete this compare?

@rtfpessoa
Copy link
Owner

Hi @darrenchang,

Unfortunately seems like the option is to make diff2html handle this in a streaming way as described here https://stackoverflow.com/questions/48698234/node-js-spawn-vs-execute

In theory it should not be hard since we parse the diff line by line, but I never tried to optimize this.
Also if you want to contribute the change this should be fixed in https://github.com/rtfpessoa/diff2html since this repo is just a cli wrapper around it.

Closing here since opened rtfpessoa/diff2html#359

@rtfpessoa
Copy link
Owner

Hi @darrenchang,

I did a possible fix and released it in version 5.1.8-fixignorepathsusespawn.1.37dcf7e.
Can you check if it is fixed and let me know?

@rtfpessoa rtfpessoa reopened this Feb 20, 2021
@rtfpessoa
Copy link
Owner

Let me know if it is not fixed and I will re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants