glebdmitriew / node-unzip-2

node.js cross-platform unzip using streams
MIT License
44 stars 39 forks source link

Signing errors can lead to increased CPU usage #25

Open rickyes opened 5 years ago

rickyes commented 5 years ago

I found that parsing the wrong zip resulted in increased CPU usage, and I found a problem after debug:

Parse.prototype._flush = function (callback) {
  if (!this._streamEnd || !this._streamFinish) {
    return setImmediate(this._flush.bind(this, callback));
  }

  this.emit('close');
  return callback();
};

Here _streamEnd and _streamFinish variables has been meet the conditions, so constantly registered setImmediate to the event loop

bakso commented 5 years ago

+1

liangzhuang327 commented 4 years ago

use unzip.Extract, Cpu soars from 4% to 50% and does not recover.