Skip to content

maxBuffer exceeded because of using exec instead of spawn #213

Closed

Description

@laurentdesmet

My CI builds are failing at lerna bootstrap because the npm logging level is set to info instead of warn, which causes a lot of logs and a maxBuffer exceeded error as explained here http://stackoverflow.com/questions/23429499/stdout-buffer-issue-using-node-child-process.

This is because the default maxBuffer is used when using the exec command (https://nodejs.org/dist/latest-v6.x/docs/api/child_process.html#child_process_child_process_exec_command_options_callback). This could be fixed by setting a bigger maxBuffer size (but then the next question is, how big this size should be...), or by using child_process.spawn.

Activity

  1. changed the title [-]maxBuffer exceeded because using exec instead of spawn[/-] [+]maxBuffer exceeded because of using exec instead of spawn[/+] on Jun 12, 2016
  2. hzoo commented on Jun 13, 2016

    @hzoo
    Contributor

    Related to #181 as well? what's the difference between exec/spawn?

  3. gigabo commented on Jun 13, 2016

    @gigabo
    Contributor

    Somewhat related to #181, though in that case (lerna run) the output from each package is buffered and later emitted by Lerna. In bootstrap it looks like the output is discarded, so Lerna could use spawn's stdio option to simply ignore it.

  4. added a commit that references this issue on Jun 13, 2016
    86bb31e
  5. laurentdesmet commented on Jun 13, 2016

    @laurentdesmet
    ContributorAuthor

    Indeed, somewhat related to #181: there an error is thrown because the stderr buffer is exceeded. In my case, it is the stdout buffer. exec will buffer the stdout and stderr channels of a process, where spawn will stream these channels. spawn is recommended if your child process emits a lot of data through stderr or stdout, see this article: http://www.hacksparrow.com/difference-between-spawn-and-exec-of-node-js-child_process.html. In this case, spawn would be more suited.

  6. added a commit that references this issue on Jun 14, 2016
    f81b12a
  7. lock commented on Dec 28, 2018

    @lock

    This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  8. locked as resolved and limited conversation to collaborators on Dec 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions