JamieMason / ImageOptim-CLI

Make optimisation of images part of your automated build process
https://foldleft.io/image-tools
MIT License
3.45k stars 126 forks source link

MaxBufferError: stderr maxBuffer exceeded #173

Closed NithinBiliya closed 5 years ago

NithinBiliya commented 5 years ago

Steps To Reproduce The Error

Run imageoptim-cli on a large number of files (eg - 3409)

Expected Behaviour

optimizes all the files

Actual Behaviour

exception thrown - MaxBufferError: stderr maxBuffer exceeded

Version Numbers or N/A

imageoptim-cli version - 2.3.5

Error stack -

nithinkumarbiliya:uploads nithinkumarbiliya$ find . -type f | wc -l
    3409
nithinkumarbiliya:uploads nithinkumarbiliya$ du -h -d 0 .
3.0G    .
nithinkumarbiliya:uploads nithinkumarbiliya$ du -d 0 .
6382216 .
nithinkumarbiliya:uploads nithinkumarbiliya$ 
nithinkumarbiliya:uploads nithinkumarbiliya$ imageoptim .
i Running ImageOptim...
! stderr maxBuffer exceeded

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    MaxBufferError: stderr maxBuffer exceeded
        at PassThrough.stream.on (/Users/nithinkumarbiliya/.nvm/versions/node/v8.11.3/lib/node_modules/imageoptim-cli/dist/imageoptim:15430:19)
        at PassThrough.emit (events.js:187:15)
        at addChunk (_stream_readable.js:283:12)
        at readableAddChunk (_stream_readable.js:260:13)
        at PassThrough.Readable.push (_stream_readable.js:219:10)
        at PassThrough.Transform.push (_stream_transform.js:151:32)
        at PassThrough.afterTransform (_stream_transform.js:92:10)
        at PassThrough._transform (_stream_passthrough.js:42:3)
        at PassThrough.Transform._read (_stream_transform.js:190:10)
        at PassThrough.Transform._write (_stream_transform.js:178:12)
nithinkumarbiliya:uploads nithinkumarbiliya$ 
runofthemill commented 5 years ago

Same issue; folder with 2016 items:

❯ imageoptim --imagealpha ~/Projects/[...]/uploads/2015/04/
i Running ImageAlpha...
i Running ImageOptim...
! stderr maxBuffer exceeded

! Please raise an issue at https://github.com/JamieMason/ImageOptim-CLI/issues

    MaxBufferError: stderr maxBuffer exceeded
        at PassThrough.stream.on (/usr/local/Cellar/imageoptim-cli/2.0.4/libexec/dist/imageoptim:15882:19)
        at PassThrough.emit (events.js:187:15)
        at addChunk (_stream_readable.js:283:12)
        at readableAddChunk (_stream_readable.js:260:13)
        at PassThrough.Readable.push (_stream_readable.js:219:10)
        at PassThrough.Transform.push (_stream_transform.js:151:32)
        at PassThrough.afterTransform (_stream_transform.js:92:10)
        at PassThrough._transform (_stream_passthrough.js:42:3)
        at PassThrough.Transform._read (_stream_transform.js:190:10)
        at PassThrough.Transform._write (_stream_transform.js:178:12)

macOS 10.14.3 imageoptim-cli 2.0.4 ImageOptim 1.8.8 ImageAlpha 1.5.1

akshetpandey commented 5 years ago

Same issue with 500 files.

macOS 10.14.4 imageoptim-cli 2.0.4 ImageOptim 1.8.8 ImageAlpha 1.5.1

ruedap commented 5 years ago

Same issue with 1365 files.

macOS 10.14.4 imageoptim-cli 2.0.4 ImageOptim 1.8.8 ImageAlpha 1.5.1

thetwopct commented 5 years ago

Same issue. Any workaround?

ickc commented 5 years ago

My work around is just don’t use it for batch processing itself. Example will be using find ... -exec .... which is single threaded (imageoptim cannot be run in multiple instances.) A bit better is to use find ... -print0 xargs -0 -n ... to pass multiple paths to imageoptim for multithreading.