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

Google Storage XML head_object doesn't pass idempotent flag #416

Closed
simonschellaert opened this issue Sep 6, 2018 · 4 comments · Fixed by #498
Closed

Google Storage XML head_object doesn't pass idempotent flag #416

simonschellaert opened this issue Sep 6, 2018 · 4 comments · Fixed by #498

Comments

@simonschellaert
Copy link

I'm developing an application where we make heavy use of the Fog Google Storage XML API (fog-google 1.7.1). In particular, we are issuing HEAD requests for thousands of objects. While running this application, I'm seeing intermittent Excon::Error::Socket: end of file reached (EOFError) errors.

I was able to reproduce this issue in my Rails console as follows:

  1. Create a new connection.
connection = Fog::Storage.new(
  provider: 'Google',
  google_project: 'XXX',
  google_storage_access_key_id: 'YYY',
  google_storage_secret_access_key: 'ZZZ,
)
  1. Issue a HEAD request as follows: connection.head_object(bucket_name, file_name). This request should succeed.

  2. Wait ten minutes or longer. (A shorter interval may also work but I didn't test that.)

  3. Issue the same HEAD request again: connection.head_object(bucket_name, file_name).

  4. I now receive the aforementioned Excon::Error::Socket: end of file reached (EOFError).

I was able to resolve the issue by passing the option persistent: false when creating the connection. While analyzing the code of fog-google, I noticed that the option :idempotent => true is not passed in head_object, while that option is passed in get_object, put_object and delete_object (see below). Since that option effectively signals that Excon may retrieve the request (if the connection timed out for example), I'm guessing that might be the cause of the failures I'm seeing. I personally see no reason why head_object shouldn't be idempotent, so I think this flag could safely be added. Is this correct? Thanks in advance for the feedback.

@RigoOnRails
Copy link

@Temikus Hi! What do you think about this? Would love to see this working.

Temikus added a commit to Temikus/fog-google that referenced this issue Jun 27, 2020
To bring it into conformance with the rest of the methods, e.g. GET, PUT, DELETE

Fixes fog#416
@Temikus
Copy link
Member

Temikus commented Jun 27, 2020

@RigoTheDev I've staged the change in: #498

Can you or @simonschellaert check if it resolves your issue? Just bundle it from git or rake build for a local gem.

@RigoOnRails
Copy link

@Temikus Seems to be working! Thank you!

@Temikus
Copy link
Member

Temikus commented Jul 6, 2020

@RigoTheDev Sweet. Thanks! I'll merge shortly.

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

Successfully merging a pull request may close this issue.

3 participants