Failed to establish a new connection


#1

Hi, I meet a problem high frequency recently :when we requesting twitter api to get insight, it return error like this.
image

But when we request the same link later, it return right.
Expect your reply! Thanks!


#2

Hi @wangdao1! Are you sure it’s not from your own server? Maybe your server lost internet connectivity just when you were making that call. Just an idea… What Ads API SDK are you using?


#3

hi, we use python sdk. Our server’s network is ok when we request!


#4

@majoritasdev hi, when we get this error, our network is ok. we use ‘ping ads-api.twitter.com’ ,it is ok ,no packet dropout.And the error only happen when we ‘post /2/stats/jobs/accounts/******’ .


#5

Hi @wangdao1. Ok. Then I don’t know, we’ll wait to see what someone from the Twitter Staff says.


#6

Hey @wangdao1

Do you have a sense of when the issue occurred (specifically the date/time)? We can check on our end to see if there was any downtime.

Thanks!


#7

@imit8me hi, today we get this error again. The utctime is ‘2018-05-18 01:29:09’


#8

@imit8me When we meet this error today,our network is ok . Picture is our server network status, we don`t loss any packet.
image


#9

That is really strange. I don’t see any issues on our end. Are you seeing these issues with all endpoints, or just when calling the stats endpoints? Additionally, can you provide the exact error response you’re seeing?

Thanks!


#10

ok. This two pictures are the error info. yeah,we meet when calling the stats endpoints, other endpoints we don`t meet this error.
image


#11

@imit8me This error is not occured inevitable, but recently it occured every day one time.


#12

Hi @wangdao1

The error only happens some % of the time, correct?

I general, when using our API you should build in retry mechanisms AND backoff mechanisms. If your system is calling in parallel, the # of retries could be too high because you are not backing off. All of our endpoints have basic rate limiting but the jobs POST one you should not be calling it so frequently that you are hitting this error very often.

When you implement backoff please implement exponential backoff so that the job POSTs do not continue to try to retry over and over when you get the errors. Please see posts like https://stackoverflow.com/questions/23013220/max-retries-exceeded-with-url for example of how to catch exceptions.

Only if the error is happening persistently and very often would I think it’s a problem with connection layer, and even then I would first suspect something is wrong with the libraries being used.

Thanks,

John


#13

@JBabichJapan hi,thanks. From yesterday we catch exceptions and when we get this error, we sleep some time,then we request again, it`s ok.