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.

s3.getObject().createReadStream().pipe() hangs in Node v0.10.25

See original GitHub issue

The symptoms are the same as listed here for a previous issue (https://github.com/aws/aws-sdk-js/issues/163).

It seems that intermittently, S3’s getObject() hangs and fails to return a response. When this happens, it prevents all other calls to getObject() from being returned as well, while the rest of the node application continues functioning without reporting any errors.

Supposedly the TLS regression was fixed in v0.10.20, so I shouldn’t be experiencing this error. I do not see this happen terribly often (once every few weeks), so it has been difficult to diagnose. Even when I fire off many API requests, it is impossible to manually recreate this issue.

My usage of this API is quite simple. Something to the effect of:

var params = {Bucket: 'XXXXXXXXXXXXX', Key: 'XXXXXXXXXXXX'};
res.set('Content-Type', 'application/octet-stream');
s3.getObject(params).createReadStream().pipe(res);

Like I said, this is an intermittent problem. If I restart the node application and try the same exact request, the file will download without issue.

If this is not in fact an issue with the S3 API, I would be quite grateful if someone could point me in the right direction for diagnosing the potential Node.js TLS re-regression.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisradekcommented, Jun 27, 2016

@kichooo You can set the maxSockets per client by doing the following:

// Example using s3
var https = require('https');
// ...
var s3 = new AWS.S3({
  httpOptions: {
    agent: new https({
      maxSockets: 1000 // Number will depend on your server's specs
      rejectUnauthorized: true
    })
  }
});

Closing the issue since upgrading Node seemed to fix it. Feel free to comment if defining a different value for maxSockets doesn’t fix the problem.

0reactions
lock[bot]commented, Sep 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

Read more comments on GitHub >

github_iconTop Results From Across the Web

s3.getObject().createReadStream() : How to catch the error?
Check if key exists before reading it. Catch error from stream. First: s3.getObjectMetadata(key) .promise() .then( ...
Read more >
s3.getobject(params).createreadstream() - You.com - You.com
It seems that intermittently, S3's getObject() hangs and fails to return a response. When this happens, it prevents all other calls to getObject()...
Read more >
AWS SDK for Node.js – Now Generally Available
You can use the createReadStream() method on a request object to get a handle to a stream object which supports piping raw HTTP...
Read more >
Trying to use AWS SDK S3.getObject within lambda, getting ...
However, every time I try to use the Node.js AWS SDK I am getting access denied when trying to get the object: import...
Read more >
AWS S3 file read - Medium
S3 object. Next, we read the S3 file stream using S3.getObject(s3Config).createReadStream(). s3Config is the javascript object with the s3 bucket name and ...
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