Meteor HTTP请求导致内存泄漏警告

时间:2015-08-24 21:47:28

标签: meteor memory-leaks httprequest

我有一个应用程序,我在其中制作了大约500个同步HTTP请求,我保存了网站的描述和图像。代码片段如下所示,在客户端(使用underscore.js):

_.each(websiteArray, function (website) {
  // websiteArray has about 500 urls
  Meteor.call("httpRequest", website);
});

在服务器上,使用http-more软件包和CFS-store for images:

Meteor.methods({
  httpRequest: function (website) {
    this.unblock();
    var result = HTTP.get(website.url, {timeout: 30000});
    //save the largest image into CFS-store, description into another collection
  }
});

我遇到了异步调用httpRequest方法的这些错误,并且在同步运行它时仍然可以获取它们,但不太常见:

W20150824-17:18:06.385(-4)? (STDERR) (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
W20150824-17:18:06.389(-4)? (STDERR) Trace
W20150824-17:18:06.389(-4)? (STDERR)     at Request.addListener (events.js:160:15)
W20150824-17:18:06.389(-4)? (STDERR)     at Request.init (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:618:8)
W20150824-17:18:06.389(-4)? (STDERR)     at Request.onRequestResponse (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:1127:10)
W20150824-17:18:06.389(-4)? (STDERR)     at ClientRequest.emit (events.js:95:17)
W20150824-17:18:06.389(-4)? (STDERR)     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1693:21)
W20150824-17:18:06.390(-4)? (STDERR)     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:122:23)
W20150824-17:18:06.390(-4)? (STDERR)     at CleartextStream.socketOnData [as ondata] (http.js:1588:20)
W20150824-17:18:06.390(-4)? (STDERR)     at CleartextStream.read [as _read] (tls.js:514:12)
W20150824-17:18:06.390(-4)? (STDERR)     at CleartextStream.Readable.read (_stream_readable.js:341:10)
W20150824-17:18:06.390(-4)? (STDERR)     at EncryptedStream.write [as _write] (tls.js:369:25) 
W20150824-17:18:06.469(-4)? (STDERR) (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.
W20150824-17:18:06.471(-4)? (STDERR) Trace
W20150824-17:18:06.471(-4)? (STDERR)     at Request.addListener (events.js:160:15)
W20150824-17:18:06.471(-4)? (STDERR)     at Request.start (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:937:8)
W20150824-17:18:06.472(-4)? (STDERR)     at Request.end (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:1635:10)
W20150824-17:18:06.472(-4)? (STDERR)     at end (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:676:14)
W20150824-17:18:06.472(-4)? (STDERR)     at Object._onImmediate (/home/rory/.meteor/packages/http/.1.1.0.43csqa++os+web.browser+web.cordova/npm/node_modules/request/request.js:690:7)
W20150824-17:18:06.472(-4)? (STDERR)     at processImmediate [as _immediateCallback] (timers.js:354:15)

这些警告仅仅是警告吗?我没有找到适当的程序来发送许多HTTP请求,而不是完全占用服务器。任何帮助将不胜感激。

0 个答案:

没有答案