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 the to be committed files exceed 1MB #27

Closed
RobinWijnant opened this issue Apr 29, 2020 · 11 comments · Fixed by #28
Closed

ENOBUFS error when the to be committed files exceed 1MB #27

RobinWijnant opened this issue Apr 29, 2020 · 11 comments · Fixed by #28
Labels
good first issue Good for newcomers type: bug Verified problems that need to be worked on
Projects

Comments

@RobinWijnant
Copy link
Contributor

I am trying to commit the docs folder generated in a previous step. This throws the following error after 1s on execFileSync. I found that ENOBUFS is thrown when the maxBuffer (1MB by default) gets exceeded.

This happens to be the case here. When only committing a single HTML file from the docs folder, the action succeeds as expected.

Possible solution
The buffer size can be specified as an option with execFileSync. More in the docs of Node.js. Setting an increased maxBuffer might solve the issue.

Run EndBug/add-and-commit@v4
  with:
    add: docs
    author_name: Github Workflow Bot
    author_email: bot@github.com
    message: build docs and dist
    cwd: .
    force: false
  env:
    GITHUB_TOKEN: ***
Using 'Github Workflow Bot <bot@github.com>' as author.
Error: spawnSync /home/runner/work/_actions/EndBug/add-and-commit/v4/lib/entrypoint.sh ENOBUFS
    at Object.spawnSync (internal/child_process.js:1041:20)
    at spawnSync (child_process.js:607:24)
    at Object.execFileSync (child_process.js:634:15)
    at Object.131 (/home/runner/work/_actions/EndBug/add-and-commit/v4/lib/index.js:1:576)
    at __webpack_require__ (/home/runner/work/_actions/EndBug/add-and-commit/v4/lib/index.js:1:154)
    at startup (/home/runner/work/_actions/EndBug/add-and-commit/v4/lib/index.js:1:291)
    at module.exports.87 (/home/runner/work/_actions/EndBug/add-and-commit/v4/lib/index.js:1:323)
    at Object.<anonymous> (/home/runner/work/_actions/EndBug/add-and-commit/v4/lib/index.js:1:333)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)

My workflow yml:

name: Build and release

on:
  push:
    # branches:
    #   - master
    paths-ignore:
      - 'docs/**'

jobs:
  node:
    name: Node 12
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Sync packages with cache
        uses: actions/cache@v1
        with:
          path: ./node_modules
          key: ${{ runner.os }}-node_modules-${{ hashFiles('**/yarn.lock') }}
          restore-keys: ${{ runner.os }}-node_modules-

      - name: Install packages
        run: yarn install --frozen-lockfile

      - name: Build the docs
        run: yarn document

      - name: Commit docs
        uses: EndBug/add-and-commit@v4
        with:
          add: 'docs'
          author_name: Github Workflow Bot
          author_email: bot@github.com
          message: 'build docs'
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@RobinWijnant
Copy link
Contributor Author

RobinWijnant commented Apr 29, 2020

I have increased the buffer to 100MB and it works. You can check this commit on my fork

@RobinWijnant RobinWijnant changed the title ENOBUFS error when committing too many files ENOBUFS error when the to be committed files exceed 1MB Apr 29, 2020
@EndBug EndBug added type: bug Verified problems that need to be worked on good first issue Good for newcomers labels Apr 30, 2020
@EndBug EndBug added this to To do in Main board via automation Apr 30, 2020
@EndBug
Copy link
Owner

EndBug commented Apr 30, 2020

Hi, thanks for the issue! It seems like a good idea: would you mind opening a PR for this? Also, maybe it works just fine with something less, 100MB seems a little overkill 😂

@RobinWijnant
Copy link
Contributor Author

Yes, I will open a PR soon.

My docs folder is already 10MB in size. Do you think 20MB is is suitable?

@EndBug
Copy link
Owner

EndBug commented Apr 30, 2020

Well, the buffer size is the size of the console output, which should be linked to the diff...
I've never had this problem, but I think 20 would be fine? I don't know.
Anyway, I don't think it's going to be a problem if it's "too much", so I guess 20 it's ok

@RobinWijnant
Copy link
Contributor Author

RobinWijnant commented Apr 30, 2020

Looking at this with a fresh mind. I think there is a better approach. Instead of increasing the buffer we can simply resolve the root cause, which is 'making sure the output does not exceed 1MB'.

You stated git diff --cached --exit-code is making the large stdout. By simply adding the --quiet flag no more output will be printed.

I tested this on my fork and it works. Check PR #28

@EndBug
Copy link
Owner

EndBug commented Apr 30, 2020

Perfect! This seems like a waaaaaay better solution
I'll check it out as soon as I can 👍

@EndBug EndBug moved this from To do to In progress in Main board May 1, 2020
@EndBug EndBug closed this as completed in #28 May 1, 2020
Main board automation moved this from In progress to Done May 1, 2020
@EndBug
Copy link
Owner

EndBug commented May 1, 2020

The fix has been published in a new release! you can get the fixed version using v4.0.3, v4 or latest.
Thanks for your contribution ❤️

@EndBug
Copy link
Owner

EndBug commented Jul 10, 2020

@all-contributors please add @RobinWijnant for bug and code

@allcontributors
Copy link
Contributor

@EndBug

This project's configuration file has malformed JSON: .all-contributorsrc. Error:: Unexpected token ] in JSON at position 1752

@EndBug
Copy link
Owner

EndBug commented Jul 10, 2020

@all-contributors please add @RobinWijnant for bug and code

@allcontributors
Copy link
Contributor

@EndBug

I've put up a pull request to add @RobinWijnant! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers type: bug Verified problems that need to be worked on
Projects
No open projects
Main board
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants