-
Notifications
You must be signed in to change notification settings - Fork 578
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
Assertion parser->current_buffer_.IsEmpty() failed in Node when using Upload in @aws-sdk/lib-storage in cloud environment #2843
Comments
We've also encountered this crash on AWS Lambda, and even when |
@rcausey Can you provide more details on your use case? You use the lambda to upload multipart file to S3 too? What do |
Yes, we use
We first ran into this issue when we switched from v2 to the v3 SDK. We couldn't reproduce it when we set |
@rcausey Can we isolate a simple reproducer in cloud env that can (with high confident) reproduce the issue? |
We are seeing this also. In our case, we have a Lambda handling a message from an SQS queue, and sometimes the handler dies with the error the OP described. I am pasting a stack trace from the CloudWatch log, but it looks like the How can we assist you in getting to the bottom of this? For example, can you guide us in building a custom Node.js runtime in which the Here's the stack, such as it is from a CloudWatch log for a run of Lambda where this issue hit:
|
I encountered the error as well. Found a good hint that it can be avoided, by setting the chunk size. It said the error happens when its exactly 5MB per upload. |
Do we know the reason behind the chunksize hack?
…On Tue, Jan 11, 2022 at 5:02 PM Martin Kuhn ***@***.***> wrote:
nodejs/node#39671 (comment)
<nodejs/node#39671 (comment)>
—
Reply to this email directly, view it on GitHub
<#2843 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD6E3KTYPVFTJETY4Y7VYD3UVTHI3ANCNFSM5E6NCK3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I think the assert is triggered when it's sending a Multipart Upload with at least 2 chunks and the body happens to be empty for some unknown reason. The scenario below is reproducing the error all the time. const file = await fs.open("myFile.json", 'r'); // file is 7mb
const stream = file.createReadStream({ encoding: null }); // get byte stream
await this.waitForReadable(stream);
await new Upload({
client: this.s3Client,
leavePartsOnError: false,
tags: args.tags,
params: {
Key: this.fullPath(args.fileName),
Bucket: this.bucketName,
Body: stream,
},
}).done();
|
My bad the error still happens, it still seems to be random :O What I noticed while debugging the library is that an empty PUT request is sent when the stream ended. Although it should never be triggered? Will debug tonight a bit more and double check. https://github.com/aws/aws-sdk-js-v3/blob/main/lib/lib-storage/src/Upload.ts line 136 // Use put instead of multi-part for one chunk uploads.
if (dataPart.partNumber === 1 && dataPart.lastPart) {
return await this.__uploadUsingPut(dataPart);
} |
Maybe its releated. I have called the done function twice when doing ´new Upload().done().done()´ This caused an empty stream being sent. Thus deleting the uploaded file again and perhaps a potential trigger for the Assert error. |
Yep, I haven't encountered any error since I made sure .done() is never called twice for the same upload object. |
I'm still encountering this issue. We've worked around it for now by creating a custom |
I could still reproduce this bug using '@aws-sdk/lib-storage' library, but this was not being reproduced using AWS-SDK of 2 version. If you put some data to each file - 8KB-5MB - this bug isn't reproducible. Surprisingly enough it's working pretty stable without any bugs with AWS-SDK 2 ver. |
NodeJS v18.6.0 has a fix for nodejs/node#39671 (nodejs/node@491c7619c4) |
A bug in Node 16 means that `@guardian/actions-riff-raff` can fail to upload assets to S3. See aws/aws-sdk-js-v3#2843 for more information
A bug in Node 16 means that `@guardian/actions-riff-raff` can fail to upload assets to S3. See aws/aws-sdk-js-v3#2843 for more information
Hi there, I see this issue never got addressed by anyone from the SDK team. The last comment was made in 2022 and suggested a fix from Node's side. Is this still an issue? Thanks, |
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing. |
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. |
Confirm by changing [ ] to [x] below to ensure that it's a bug:
Describe the bug
This is actually an issue in nodejs/node#39671
When using
@aws-sdk/lib-storage
to perform multipart upload to S3. NodeJs throw the following exception:This is from
node/http
module. Interestingly, this only happen on cloud env but not local dev env work fine. (Further investigation is needed to verify). It run fine almost every time in my local machine (Macbook Pro 16" Intel running node v14.17.5) with only one time I have seen the exception. But in the production env running EKS over EC2, it fail consistancly at the same point no matter the data size.This MAY NOT be an issue of
@aws-sdk/lib-storage
but it seems to be only happen when using aws sdk together in cloud env.I have tried changing my application logic to only perform 1 upload at a time and it did not crash even in cloud env (AWS EKS running on EC2). So I suspect it is a concurrent issue of some sort in either aws-sdk or nodejs level. It would be great if we (user, aws-sdk, nodejs) can work together and find a re-producer first.
Is the issue in the browser/Node.js?
Node.js and possible only happens on cloud (AWS?) ENV only
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
SDK version number
@aws-sdk/lib-storage@3.33.0
for me and I am not sure othersTo Reproduce (observed behavior)
No reproducer at this moment. Looking for someone to reproduce it.
Expected behavior
No exception thrown
Screenshots
No
Additional context
Code snippet for reference
The text was updated successfully, but these errors were encountered: