contentful-management.rb icon indicating copy to clipboard operation
contentful-management.rb copied to clipboard

Error reading from socket

Open AlexAvlonitis opened this issue 5 years ago • 7 comments

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'

AlexAvlonitis avatar Feb 17 '20 11:02 AlexAvlonitis

Are you doing batch operations? You may be exceeding the API rate

HQ063 avatar Feb 17 '20 13:02 HQ063

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?

AlexAvlonitis avatar Feb 17 '20 14:02 AlexAvlonitis

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

dlitvakb avatar Feb 17 '20 14:02 dlitvakb

Thanks for the responses @HQ063 @dlitvakb, i ran ping with 0 packet loss for about half an hour. Screenshot from 2020-02-17 15-25-16

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

AlexAvlonitis avatar Feb 17 '20 15:02 AlexAvlonitis

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!

strickland84 avatar Feb 21 '20 14:02 strickland84

I was having the same error. Downgrading to v4.1.1 of http solved the problem.

kkorach avatar Mar 03 '20 18:03 kkorach

thanks @kkorach that fixed it for me.

strickland84 avatar Mar 10 '20 20:03 strickland84