question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request hangs for some uploads

See original GitHub issue

Use this payload: http://superjoe.s3.amazonaws.com/temp/busboy-payload.pdf

node version 0.10.24 busboy 0.0.13

var http = require('http');
var Busboy = require('busboy');

var server = http.createServer(function(req, res) {
  if (req.url === '/') {
    res.statusCode = 200;
    res.end('<!doctype html>'+
      '<html>'+
      '<head>'+
      '</head>'+
      '<body>'+
      '<form action="/upload" method="post" enctype="multipart/form-data">'+
      '  <input type="file" name="avatar">'+
      '  <input type="submit">'+
      '</form>'+
      '</body>'+
      '</html>');
  } else if (req.url === '/upload') {
    var bboy = new Busboy({
      headers : req.headers,
      limits  : {fileSize:2*1024*1024, files:1}
    });

    bboy.on('file', function(fieldname, file, filename, encoding, mimetype){
      console.log("aborting the request");
      res.statusCode = 400;
      res.end("hello browser");
    });
    req.pipe(bboy);
  } else {
    console.info("unexpected path", req.url);
  }
});

server.listen(9191, function() {
  console.info("listening at http://0.0.0.0:9191/");
});

When I upload that payload, the request completely hangs. The browser never sees “hello browser”.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andrewrkcommented, Jan 3, 2014

file.resume() is the magic sauce here. I now see that it is mentioned in the docs to do this, but it is a little bit buried. I added a suggested example to the readme in the hopes that it might prevent other people from running into this.

0reactions
mscdexcommented, Jan 4, 2014

Right, as I mentioned, file.resume(); is fine in that case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Post request hangs in certain cases when body is a StringIO
This is how StringIO instances work and misusing them is not a bug in requests because partial file uploads are very desirable. Especially...
Read more >
For no obvious reasons, my request hangs when I try to ...
When request hangs control gained back is not printed(when I try to upload files bigger than 20 mb) But I see below error...
Read more >
Python requests .post hangs on large HTTPS payload
I am uploading some data to a graph DB using a POST call, as follows: with open(turtle, 'rb') as data: if graph: params...
Read more >
IIS7 hangs on requests while uploading file - Server Fault
The problem is that, when I start an upload and meanwhile try to continue using the application in another tab, the request just...
Read more >
Error Request timed out when you try to upload a large file to a ...
Describes an issue that occurs when you try to upload a large file to a document library on a Windows SharePoint Services 3.0...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found