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

activating aws_sdk patching affects Lambda responses sometimes #11

Open
toaster opened this issue Sep 7, 2018 · 3 comments
Open

activating aws_sdk patching affects Lambda responses sometimes #11

toaster opened this issue Sep 7, 2018 · 3 comments
Labels

Comments

@toaster
Copy link

toaster commented Sep 7, 2018

I use the aws-sdk-lambda gem to invoke Lambda functions with the Aws::Lambda::Client#invoke method. My functions return JSON strings which then get parsed.

Recently I added X-Ray via the aws-xray-sdk gem and found that if I activate the net_http and aws_sdk patches the response of the Lambda functions sometimes gets scrambled. One or more of the last bytes are appended to the end which leads to a parsing error.
AFAICS this happens to longer responses (around 1K) only but not to short (around 100 bytes) ones. Also when retrying the invocation immediately the response is unscrambled.
When disabling the aws_sdk patch this does not seem to happen.

@haotianw465
Copy link
Contributor

Hi, thank you for reporting the issue. Could you provide the stack trace for the parsing error you mentioned so we can take a further look?

@toaster
Copy link
Author

toaster commented Sep 13, 2018

I'm not allowed to, but I don't think that this would help because the response is already fully read and any code touching it is no longer in the stack trace.
However, I have another detail that may be of interest: The issue only happens in multi-threaded (MRI with GIL) environment. We perform around 15 Lambda calls in parallel. Maybe it's a thread-safety issue?

@haotianw465
Copy link
Contributor

I will take a look at aws_sdk patching code and see if there is any potential issue. Please feel free to share any further findings or a sample repro script. That would also help a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants