Node.js:内存和内存中的文件上传缓冲区在上传完成后没有释放

时间:2016-01-05 10:19:56

标签: javascript node.js azure heroku sails.js

使用Sails.js将代码上传到Azure:

req.file('picture').upload({
      adapter: require('skipper-azure'),
      key: storageAccount,
      secret: accessKey,
      container: 'default'
    }, function(err, files) {
        if(!err) {
            return res.json(cdn + files[0].fd);
        } else {
            return res.send(err);
        }
    });

我有两个问题:

  • 文件缓冲到内存而不是流式传输
  • 文件上传完成后内存没有释放,是Node.js问题,Sails.js还是我的问题?

更新

当我上传512MB文件时,我在Heroku上收到以下错误:

  

2016-01-05T17:17:18.083883 + 00:00 heroku [router]:at = error code = H13   desc =“没有响应的连接关闭”方法= POST   path =“/ uploader / upload”host = abc.herokuapp.com   request_id = fc2c32ed-35da-48de-8949-20f2a505d8eb fwd =“41.35.30.180”

     

dyno = web.1 connect = 0ms service = 120024ms status = 503 bytes = 0

     

2016-01-05T17:17:18.081447 + 00:00 app [web.1]:undefined

     

2016-01-05T17:17:18.089304 + 00:00 app [web.1]:发送500(“服务器”   错误“)回复:2016-01-05T17:17:18.089309 + 00:00 app [web.1]:错误:   请求中止2016-01-05T17:17:18.089311 + 00:00 app [web.1]:at   IncomingMessage.onReqAborted   (/app/node_modules/skipper/node_modules/multiparty/index.js:175:17)

     

2016-01-05T17:17:18.089311 + 00:00 app [web.1]:在emitNone   (events.js:67:13)2016-01-05T17:17:18.089312 + 00:00 app [web.1]:at   IncomingMessage.emit(events.js:166:7)

     

2016-01-05T17:17:18.089313 + 00:00 app [web.1]:at abortIncoming   (_http_server.js:280:11)2016-01-05T17:17:18.089314 + 00:00 app [web.1]:   在Socket.serverSocketCloseListener(_http_server.js:293:5)

     

2016-01-05T17:17:18.089314 + 00:00 app [web.1]:在emitOne   (events.js:82:20)

     

2016-01-05T17:17:18.089315 + 00:00 app [web.1]:at   Socket.emit(events.js:169:7)2016-01-05T17:17:18.089316 + 00:00   app [web.1]:at TCP._onclose(net.js:469:12)[错误:请求   中止]

0 个答案:

没有答案