contentful-management.rb
contentful-management.rb copied to clipboard
Error reading from socket
Intermittent connection issues when updating-deleting records. As a workourand I'm retrying the request.
error reading from socket: Could not parse data (HTTP::ConnectionError)
~/gems/http-4.3.0/lib/http/response/parser.rb:31:in `add'
~/gems/http-4.3.0/lib/http/connection.rb:217:in `read_more'
~/gems/http-4.3.0/lib/http/connection.rb:103:in `read_headers!'
~/gems/http-4.3.0/lib/http/client.rb:75:in `perform'
~/gems/http-4.3.0/lib/http/client.rb:31:in `request'
~/gems/http-4.3.0/lib/http/chainable.rb:41:in `delete'
~/gems/contentful-management-2.11.0/lib/contentful/management/client.rb:496:in `public_send'
~/gems/contentful-management-2.11.0/lib/contentful/management/client.rb:496:in `http_send'
~/gems/contentful-management-2.11.0/lib/contentful/management/client.rb:435:in `block in delete'
~/gems/contentful-management-2.11.0/lib/contentful/management/client.rb:386:in `execute_request'
~/gems/contentful-management-2.11.0/lib/contentful/management/client.rb:434:in `delete'
~/gems/contentful-management-2.11.0/lib/contentful/management/request.rb:56:in `delete'
~/gems/contentful-management-2.11.0/lib/contentful/management/resource_requester.rb:94:in `delete'
~/gems/contentful-management-2.11.0/lib/contentful/management/resource_requester.rb:42:in `destroy'
~/gems/contentful-management-2.11.0/lib/contentful/management/resource.rb:85:in `destroy'
Are you doing batch operations? You may be exceeding the API rate
I'm trying the same set of data every time, fails intermittently, about 700 entries not faster than 1 entry per second. At some point i'm fetching entries with the paginated data, I added 1 sec throttle there as well. Wouldn't it return rate limit error if it was exceeding the limits?
Hey @AlexAvlonitis,
This is usually related to connection issues on the client's network end. Is it possible for you to run a ping
check on your end and check if there's any packet loss? If you're having network issues, this is an easy way to diagnose it.
Cheers
Thanks for the responses @HQ063 @dlitvakb, i ran ping with 0 packet loss for about half an hour.
Also found out this and might be relevant, someone had similar issue with the http gem, and i think they patched it recently https://github.com/httprb/http/issues/589
I have the same error when attempting to retrieve all/any specific content types using this gem:
require 'contentful/management'
client = Contentful::Management::Client.new(@@cma_key)
content_types = client.content_types(@@space, @@environment).all
content_types gives *** HTTP::ConnectionError Exception: error reading from socket: Could not parse data
This code used to work with no problem, and hasn't changed for about 18 months on my end. Lately this call is failing 100% of the time with this HTTP error.
I have tried upgrading the HTTP gem with no luck. All my other API calls work, such as entries. It seems anything related to content_types
is not working. Any advice? Thanks!
I was having the same error. Downgrading to v4.1.1 of http solved the problem.
thanks @kkorach that fixed it for me.