Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib-storage: upload file of 112 GB crash chrome for out of memory (after 25 GB) #5730

Open
3 tasks done
cesco69 opened this issue Jan 26, 2024 · 1 comment
Open
3 tasks done
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@cesco69
Copy link

cesco69 commented Jan 26, 2024

Checkboxes for prior research

Describe the bug

I have bundled @aws-sdk/lib-storage and @aws-sdk/client-s3 with webpack for use it on frontend
If upload a file of 112 GB, after 25 GB chrome crash for out of memory

SDK version number

@aws-sdk/[email protected], @aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Browser

Details of the browser/Node.js/ReactNative version

Latest chrome

Reproduction Steps

I have bundled @aws-sdk/lib-storage and @aws-sdk/client-s3 with webpack for use it on frontend

package.json

{
  "name": "aws-s3-upload",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "build": "webpack"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@aws-sdk/client-s3": "^3.499.0",
    "@aws-sdk/lib-storage": "^3.499.0"
  },
  "devDependencies": {
    "path-browserify": "^1.0.1",
    "webpack": "^5.90.0",
    "webpack-cli": "^5.1.4"
  }
}

browser.js

const { S3Client } = require('@aws-sdk/client-s3');
const { Upload } = require("@aws-sdk/lib-storage");
window.AWS = { S3Client, Upload }
export { S3Client, Upload };

webpack.config.js

// Import path for resolving file paths
var path = require("path");
module.exports = {
  mode: 'production',
  performance: {
    hints: false
  },
  // Specify the entry point for our app.
  entry: [path.join(__dirname, "browser.js")],
  // Specify the output file containing our bundled code.
  output: {
    path: __dirname,
    filename: 'bundle.js'
  },
  // Enable WebPack to use the 'path' package.
  resolve: {
    fallback: { path: require.resolve("path-browserify") }
  }
};

Build produce bundle.js

npm run buid

usage

index.html

 <script src="bundle.js"></script>
 <script>
  const s3Client = new AWS.S3Client({
    region:  ...,
    endpoint:  ...,
    credentials: {
          accessKeyId: ...,
          secretAccessKey:  ...,
          sessionToken:  ...,
     }
   });
   const uploadParams = {
     Bucket: ...,
     Key: ...,
     Body: file // file from <input type="file">
   };
  const upload = new AWS.Upload({
    client: s3Client ,
    params: uploadParams,
    queueSize: 4, // optional concurrency configuration
    partSize: 1024 * 1024 * 5, // optional size of each part
    leavePartsOnError: false, // optional manually handle dropped parts
  });

  upload .on("httpUploadProgress", (progress) => {
    console.log(progress);
  });
  await upload.done();
</script>

If upload a file of 112 GB, after 25 GB chrome crash for out of memory.

Observed Behavior

Chrome crash for out of memory after 25 GB of uploaded file

Expected Behavior

no crash

Possible Solution

No response

Additional Information/Context

Side note: it works with SDK 2.0

@cesco69 cesco69 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 26, 2024
@RanVaknin RanVaknin self-assigned this Mar 5, 2024
@RanVaknin RanVaknin added investigating Issue is being investigated and/or work is in progress to resolve the issue. p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Mar 5, 2024
@RanVaknin
Copy link
Contributor

Hi there,

I'm able to reproduce this behavior both on Chrome and on Firefox. After roughly 40gb I'm seeing (the network tab uploads up to 40gb and then this error is being raised).
image

This behavior is the same between v2 and v3.

Thanks,
Ran~

@RanVaknin RanVaknin added queued This issues is on the AWS team's backlog and removed investigating Issue is being investigated and/or work is in progress to resolve the issue. labels May 10, 2024
@RanVaknin RanVaknin removed their assignment Aug 7, 2024
@cesco69 cesco69 changed the title lib-storage: upload file of 112 GB crash chrome for out of memory lib-storage: upload file of 112 GB crash chrome for out of memory (after 25 GB) Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
Development

No branches or pull requests

2 participants