-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
encountering NoMethodError: undefined method `map' for nil:NilClass #516
Comments
hello, any idea why this is happening? it happens occasionally, not all the time. it seems like
|
Yes, it seems so. DynamoDB Query response doesn't contain the I haven't found in the DynamoDB documentation any statement that |
Could you please specify a version of the |
|
Here is a more recent stacktrace with ruby 3.0 and latest version of dynamoid. aws-sdk 3.0, aws-sdk-dynamodb 1.80.0.
This is /var/app/current/app/models/client.rb:360:
|
Is it possible to reproduce the issue with enabled |
I can try. It happens every few days. My logs are stored in CloudWatch and I'm not sure how noisy Can you prepare the branch? |
Will do. Will use the mentioned above release (3.8.0) Is the issue reproducible on some non-production environment? |
Yes, it happens for both my test and prod env, so I will try to observe my test env for it. Thanks. |
Please check https://github.com/Dynamoid/dynamoid/tree/add-http-wire-trace-config-option It should be set this way: Dynamoid.configure do |config|
# ...
config.http_wire_trace = true
end The output for one DynamoDB operation may look like the following:
|
Thanks. I will report back in a few days. |
Nice!
Ah, there is an |
@andrykonchin Do you mind plugging this into a separate branch like the wire trace debug? aws/aws-sdk-ruby#2914 (comment) |
Is there a possibility of a multithreading bug in dynamoid that's causing this? DynamoDB team is saying @rhuang's request ends up being processed as PutItem. It may be possible a PutItem and a Query were happening very close together in a multithreaded way, and Dynamoid may be handling that wrong response. |
Updated the https://github.com/Dynamoid/dynamoid/tree/add-http-wire-trace-config-option branch to print HTTP request body |
Only one single instance of So potentially if two threads send requests using the same client object and this client object uses one TCP connection - then it seems possible that threads receive wrong responses. But I was under the impression that AWS Ruby SDK handles concurrency issues on its own and uses a pool of TCP connections (or HTTP clients) to ensure that any operation (put/query/etc) uses its own dedicated TCP connection/HTTP client. I haven't found any mentioning of thread-safety in the AWS Ruby SDK documentation but have found synchronisation mechanisms in the source code (e.g. here). Could you or Ruby SDK maintainers please clarify whether Ruby SDK is thread safe by default? |
Yes, it should be thread safe to use one client, assuming no bugs. We do use a connection pool and a different connection for each request. We've also not seen any reports of this outside of @rhuang + dynamoid. Hopefully debugging the body will reveal some more information. |
Thank you! |
Thanks. I will update the Dynamoid client and hopefully report back in a few days when the log is captured. We do use multithreading in the application and DynamoDB is called within threads in various ways, including puts and gets, all from the Dynamoid client. |
Just confirming what @mullermp said - I've reviewed the SDK's client + connection pool + net:http client code and agree it should be thread safe and don't see any potential threading issues that could cause this. |
@andrykonchin Could you please review the snippets from @rhuang here and check the original stack trace for potential issues? aws/aws-sdk-ruby#2914 (comment) I am thinking Dynamoid has an issue with forwarding arguments in some cases. The request body is intended for query but it appears to be making a put item call. |
Yes, I will investigate the issue further on the Dynamoid's side. It's great that the issue could be reproduced. |
@rhuang I would like to check one more time logs to ensure there is an issue with request body. I have added some debug info in the And change configuration a bit:
So this way request body/headers + response body will be printed together. |
@andrykonchin I will do this. Will report back in a few days. |
Hi @andrykonchin, I'm running into this error:
My code is here:
|
Ah, right. Please add require 'dynamoid/log/formatter' |
@rhuang Did have a chance to check with extended logging? |
@andrykonchin Sorry, not yet. We have been busy with some projects, but I can confirm the issue is still happening from my error alerts. I spent some time earlier to find extended logging but it was difficult to match my service request logs to to the correct extended logging. |
I have a piece of code that sometimes throws the exception:
My code is this:
MyModel.where(id: id)&.any? { ... }
, whereid
is a GSI.Any idea what might be the problem?
The stacktrace is below:
The text was updated successfully, but these errors were encountered: