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
PutObject takes lot of memory when client logmode aws.LogRequest is enabled #1618
Comments
From a quick glance at the
While it doesn't actually read the body it still fills in the body of the dummy request with the same amount of content just replace with all At first glance it looks like you setting So TLDR, it looks like this is an issue with how the standard library handles debug logging of requests, and is more likely a request to the upstream Go compiler on trying to improve this code path for logging the request without the body and additional memory allocations. |
Then can we write a DumpRequest of our own in aws-sdk-go-v2 and not use the standard library. Meanwhile, let me try to raise an issue to golang and see if I can convince them to fix this issue somehow 😄 |
I think the issue is better solved in the standard library, and I’ve produced a fix that I can work on getting upstreamed, but if accepted I’m not sure when it would make it into the compiler release. |
hmm ok, let us take it to Go. Rewriting all that here in AWS client will be a much bigger task anyway. I hope we can make it before Go 19. 🤞 |
|
golang/go#51662 is the PR I have put together for this as an FYI. |
Documentation
Describe the bug
Hi,
With the client having ClientLogMode set to aws.LogRequest and putObject request , the client consumes memory equal to the size of the data. When log mode is not set, the client consumes only minimal memory.
Note that I understand that we should not use PutObject for files bigger than 100MB and use upload instead. But this issue exists nevertheless.
Expected behavior
It is expected that when ClientLogMode is set to LogRequestWithBody, it will consume memory equal to size of the data.
but when ClientLogMode is set to LogRequest, it should not consume memory as per the data size.
Current behavior
When clientMode is set to aws.LogRequest and putObject is done using the client, the client consumes memory equal to the size of the data(file in my case). Since only log request is set, (and not logRequestWithBody), this is somewhat unexpected.
Steps to Reproduce
code:
go code with github.com/aws/aws-sdk-go-v2 v1.13.0
run using any of the S3 service, eg. minio or AWS-S3
steps to reproduce issues
The complete command with output is attached here.
aws_sdk_go_logrequest_issue.txt
Thanks,
Prem
Possible Solution
I am not really sure, some fix needed in file
vendor/github.com/aws/smithy-go/transport/http/middleware_http_logging.go
and functionfunc (r *RequestResponseLogger) HandleDeserialize( ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler, )
AWS Go SDK version used
1.13.0
Compiler and Version used
go version go1.17.6 linux/amd64
Operating System and version
Linux prem-lubuntu 5.4.0-100-generic #113-Ubuntu SMP Thu Feb 3 18:43:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: